Project Part 3
13.01.2024
Zeynep Sude Aksoy – 2020402108
Hasancan Cebeci – 2019402036
In the realm of linen manufacturing, the production of high-quality linen garments is a complex process. Linen, derived from the fibers of the flax plant, possesses unique properties such as exceptional coolness and freshness in hot weather. The manufacturing process, though laborious, is crucial in delivering premium linen products to consumers. This project focuses on the implementation of quality control measures using image analysis to identify defects in linen production.
Manual Inspection Era: In the earlier stages of linen manufacturing, process monitoring heavily relied on manual inspection. Skilled workers visually examined linen materials for defects and irregularities. While this approach had its merits, it was subjective, labor-intensive, and less suited for large-scale production.
Automation and Image Processing: With technological advancements, there has been a notable shift towards automating visual inspection using image processing techniques. Researchers and industry professionals recognized the need for sophisticated image acquisition systems and efficient procedures for texture analysis in materials production, including textiles like linen.
Texture Analysis: Texture analysis emerged as a crucial aspect of process monitoring in linen manufacturing. Researchers explored the application of image processing algorithms to analyze the texture of linen fabrics. These techniques aimed to identify patterns, defects, and irregularities in the material.
Statistical Process Control (SPC): The integration of Statistical Process Control (SPC) principles into linen manufacturing gained attention. Traditional control charts, widely used in manufacturing for process monitoring, were adapted to monitor the quality of linen production. However, challenges arose due to the spatial nature of image data, prompting the exploration of advanced statistical methods.
Challenges and Opportunities: Challenges in process monitoring for linen manufacturing include the complex and heterogeneous nature of linen materials, the need for real-time defect detection, and adapting statistical methods to handle image data. The literature explores these challenges and identifies opportunities for future research.
Advanced Machine Learning Techniques: More recently, the literature has seen an increased exploration of advanced machine learning techniques for process monitoring in textiles. This includes the application of algorithms for pattern recognition, anomaly detection, and predictive maintenance in linen manufacturing.
Integration of Industry 4.0 Technologies: Industry 4.0 concepts, such as the Internet of Things (IoT) and smart manufacturing, are being explored to enhance process monitoring in linen manufacturing. Real-time data collection, connectivity, and analytics play a role in optimizing production processes.
A Baseline Defect Detection Approach from a Statistical Data Analysis Perspective:
First we have put pixel values in a matrix and plotted the pixel values
#Part1.1
library(jpeg)
library(MASS)
library(mixtools)
## mixtools package, version 2.0.0, Released 2022-12-04
## This package is based upon work supported by the National Science Foundation under Grant No. SES-0518772 and the Chan Zuckerberg Initiative: Essential Open Source Software for Science (Grant No. 2020-255193).
# Read the color image
img <- readJPEG("~/Desktop/Dersler/IE423/outputimage.jpg")
# Part 1.1
# Flatten the 2D matrix to a vector
pixel_values <- as.matrix(img)
head(pixel_values)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,] 0.7490196 0.7490196 0.6980392 0.6117647 0.5294118 0.4274510 0.3490196
## [2,] 0.7882353 0.7764706 0.7215686 0.6666667 0.6196078 0.5294118 0.4352941
## [3,] 0.8117647 0.8078431 0.7607843 0.7098039 0.6666667 0.5921569 0.5137255
## [4,] 0.8078431 0.8235294 0.7843137 0.7098039 0.6313725 0.5490196 0.5019608
## [5,] 0.8196078 0.8313725 0.7843137 0.6941176 0.6000000 0.5058824 0.4470588
## [6,] 0.8156863 0.8039216 0.7411765 0.6705882 0.6117647 0.5215686 0.4274510
## [,8] [,9] [,10] [,11] [,12] [,13] [,14]
## [1,] 0.3294118 0.3450980 0.3490196 0.3647059 0.3921569 0.4352941 0.5098039
## [2,] 0.3921569 0.3450980 0.3450980 0.3686275 0.4235294 0.4941176 0.5725490
## [3,] 0.4823529 0.4274510 0.3960784 0.3882353 0.4392157 0.5333333 0.6313725
## [4,] 0.5137255 0.4784314 0.4431373 0.4274510 0.4745098 0.5686275 0.6666667
## [5,] 0.4509804 0.4235294 0.4274510 0.4627451 0.5372549 0.6274510 0.7019608
## [6,] 0.3921569 0.3960784 0.4196078 0.4705882 0.5450980 0.6196078 0.6980392
## [,15] [,16] [,17] [,18] [,19] [,20] [,21]
## [1,] 0.6078431 0.6862745 0.7411765 0.7058824 0.6509804 0.6392157 0.5411765
## [2,] 0.6470588 0.6980392 0.7254902 0.7294118 0.7254902 0.7411765 0.6392157
## [3,] 0.7098039 0.7607843 0.8352941 0.8156863 0.7764706 0.7490196 0.6274510
## [4,] 0.7490196 0.7960784 0.8431373 0.8352941 0.8039216 0.7764706 0.6352941
## [5,] 0.7647059 0.8039216 0.8509804 0.8470588 0.8117647 0.7843137 0.6470588
## [6,] 0.7725490 0.8274510 0.8862745 0.8705882 0.8196078 0.7843137 0.6509804
## [,22] [,23] [,24] [,25] [,26] [,27] [,28]
## [1,] 0.5058824 0.4274510 0.3764706 0.3764706 0.3450980 0.3215686 0.3372549
## [2,] 0.5686275 0.4509804 0.3686275 0.3490196 0.3294118 0.3215686 0.3647059
## [3,] 0.5647059 0.4745098 0.4196078 0.3764706 0.3607843 0.3607843 0.4078431
## [4,] 0.5568627 0.4549020 0.4000000 0.3333333 0.3254902 0.3450980 0.4039216
## [5,] 0.5764706 0.4823529 0.4352941 0.4039216 0.3882353 0.3960784 0.4431373
## [6,] 0.5921569 0.5137255 0.4745098 0.4313725 0.4000000 0.3843137 0.4117647
## [,29] [,30] [,31] [,32] [,33] [,34] [,35]
## [1,] 0.3882353 0.4666667 0.5529412 0.6156863 0.6705882 0.6196078 0.5529412
## [2,] 0.4470588 0.5568627 0.6666667 0.7450980 0.7372549 0.7372549 0.7176471
## [3,] 0.4901961 0.5921569 0.6941176 0.7647059 0.7686275 0.8039216 0.8117647
## [4,] 0.4941176 0.6000000 0.6980392 0.7686275 0.8078431 0.8313725 0.7960784
## [5,] 0.5294118 0.6352941 0.7411765 0.8117647 0.7882353 0.7960784 0.7450980
## [6,] 0.4862745 0.5882353 0.6980392 0.7725490 0.7803922 0.7803922 0.7450980
## [,36] [,37] [,38] [,39] [,40] [,41] [,42]
## [1,] 0.4980392 0.4509804 0.4156863 0.4078431 0.4156863 0.4235294 0.4039216
## [2,] 0.6705882 0.5960784 0.5176471 0.4509804 0.4117647 0.4431373 0.4274510
## [3,] 0.7529412 0.6627451 0.5725490 0.4862745 0.4274510 0.3803922 0.3725490
## [4,] 0.6862745 0.5686275 0.4901961 0.4313725 0.3843137 0.4039216 0.3803922
## [5,] 0.6313725 0.5372549 0.4980392 0.4823529 0.4588235 0.4392157 0.4039216
## [6,] 0.6745098 0.6117647 0.5803922 0.5607843 0.5411765 0.4980392 0.4627451
## [,43] [,44] [,45] [,46] [,47] [,48] [,49]
## [1,] 0.4196078 0.4509804 0.4901961 0.5764706 0.6666667 0.7019608 0.7333333
## [2,] 0.4588235 0.5176471 0.5803922 0.6862745 0.7803922 0.8117647 0.8549020
## [3,] 0.4156863 0.4980392 0.5960784 0.7215686 0.8196078 0.8470588 0.8549020
## [4,] 0.4117647 0.4901961 0.5921569 0.7098039 0.7960784 0.8117647 0.7843137
## [5,] 0.4078431 0.4666667 0.5450980 0.6470588 0.7137255 0.7176471 0.7921569
## [6,] 0.4745098 0.5372549 0.6196078 0.7176471 0.7803922 0.7803922 0.7803922
## [,50] [,51] [,52] [,53] [,54] [,55] [,56]
## [1,] 0.7372549 0.6588235 0.5882353 0.5372549 0.4980392 0.4745098 0.4078431
## [2,] 0.8705882 0.8156863 0.7607843 0.6823529 0.5921569 0.5294118 0.4470588
## [3,] 0.8745098 0.8431373 0.8196078 0.7450980 0.6313725 0.5607843 0.4901961
## [4,] 0.7882353 0.7568627 0.7450980 0.6823529 0.5921569 0.5607843 0.5294118
## [5,] 0.7803922 0.7254902 0.6941176 0.6352941 0.5607843 0.5529412 0.5372549
## [6,] 0.7725490 0.7019608 0.6588235 0.6000000 0.5411765 0.5372549 0.5098039
## [,57] [,58] [,59] [,60] [,61] [,62] [,63]
## [1,] 0.4000000 0.3607843 0.3215686 0.3764706 0.5098039 0.6196078 0.6745098
## [2,] 0.4000000 0.3764706 0.3607843 0.4392157 0.5921569 0.7058824 0.7686275
## [3,] 0.4666667 0.4392157 0.4117647 0.4784314 0.6196078 0.7254902 0.7803922
## [4,] 0.4745098 0.4431373 0.4117647 0.4705882 0.6117647 0.7254902 0.7960784
## [5,] 0.5098039 0.4784314 0.4509804 0.5019608 0.6235294 0.7176471 0.7686275
## [6,] 0.5294118 0.5058824 0.4823529 0.5294118 0.6313725 0.6901961 0.7137255
## [,64] [,65] [,66] [,67] [,68] [,69] [,70]
## [1,] 0.7215686 0.7215686 0.7529412 0.7450980 0.6509804 0.4862745 0.4235294
## [2,] 0.8156863 0.8392157 0.8313725 0.7882353 0.6980392 0.5490196 0.4941176
## [3,] 0.8235294 0.8588235 0.8392157 0.8078431 0.7647059 0.6431373 0.5725490
## [4,] 0.8509804 0.8509804 0.8156863 0.7843137 0.7450980 0.6117647 0.5176471
## [5,] 0.8117647 0.7843137 0.7450980 0.7019608 0.6509804 0.5294118 0.4666667
## [6,] 0.7372549 0.7254902 0.7137255 0.6901961 0.6470588 0.5333333 0.4980392
## [,71] [,72] [,73] [,74] [,75] [,76] [,77]
## [1,] 0.3098039 0.2941176 0.2823529 0.3372549 0.4000000 0.4470588 0.5058824
## [2,] 0.3843137 0.3803922 0.4588235 0.4705882 0.4666667 0.4549020 0.4823529
## [3,] 0.4431373 0.4274510 0.3921569 0.3921569 0.3843137 0.3843137 0.4392157
## [4,] 0.3686275 0.3529412 0.3607843 0.3686275 0.3843137 0.4117647 0.4823529
## [5,] 0.3647059 0.3843137 0.3921569 0.4000000 0.4117647 0.4431373 0.5215686
## [6,] 0.4196078 0.4431373 0.3843137 0.3725490 0.3647059 0.3882353 0.4705882
## [,78] [,79] [,80] [,81] [,82] [,83] [,84]
## [1,] 0.6078431 0.7294118 0.8078431 0.7960784 0.7647059 0.6980392 0.5450980
## [2,] 0.5764706 0.6980392 0.7843137 0.8235294 0.7960784 0.7254902 0.5764706
## [3,] 0.5529412 0.6862745 0.7647059 0.7921569 0.8078431 0.8039216 0.6980392
## [4,] 0.5843137 0.6823529 0.7333333 0.7686275 0.7843137 0.7725490 0.6666667
## [5,] 0.6196078 0.7058824 0.7450980 0.7647059 0.7764706 0.7725490 0.6784314
## [6,] 0.5921569 0.7019608 0.7568627 0.7764706 0.7921569 0.7921569 0.7098039
## [,85] [,86] [,87] [,88] [,89] [,90] [,91]
## [1,] 0.4666667 0.3529412 0.3372549 0.3411765 0.3960784 0.3843137 0.3764706
## [2,] 0.5058824 0.4078431 0.4078431 0.4274510 0.3450980 0.3450980 0.3764706
## [3,] 0.6274510 0.4823529 0.4235294 0.4039216 0.3647059 0.3843137 0.4470588
## [4,] 0.5960784 0.4588235 0.4078431 0.3960784 0.4156863 0.4039216 0.4274510
## [5,] 0.6196078 0.4901961 0.4392157 0.4196078 0.3843137 0.4039216 0.4588235
## [6,] 0.6666667 0.5333333 0.4627451 0.4274510 0.3725490 0.4392157 0.5568627
## [,92] [,93] [,94] [,95] [,96] [,97] [,98]
## [1,] 0.3882353 0.4274510 0.4784314 0.5254902 0.5529412 0.5411765 0.5882353
## [2,] 0.4588235 0.5764706 0.6901961 0.7647059 0.7960784 0.7960784 0.7882353
## [3,] 0.5647059 0.6941176 0.7764706 0.7882353 0.7725490 0.7372549 0.7333333
## [4,] 0.5137255 0.6392157 0.7411765 0.7921569 0.8000000 0.8196078 0.7843137
## [5,] 0.5607843 0.6784314 0.7725490 0.8196078 0.8274510 0.8078431 0.7764706
## [6,] 0.6862745 0.7882353 0.8235294 0.8000000 0.7725490 0.7647059 0.7607843
## [,99] [,100] [,101] [,102] [,103] [,104] [,105]
## [1,] 0.5372549 0.4745098 0.4078431 0.3411765 0.3333333 0.3215686 0.3607843
## [2,] 0.6745098 0.5607843 0.4549020 0.3607843 0.3490196 0.3411765 0.3215686
## [3,] 0.6666667 0.6039216 0.5019608 0.3882353 0.3529412 0.3215686 0.3803922
## [4,] 0.7058824 0.6274510 0.5019608 0.3921569 0.3843137 0.3647059 0.3215686
## [5,] 0.7098039 0.6196078 0.4588235 0.3372549 0.3333333 0.2980392 0.2784314
## [6,] 0.7411765 0.6862745 0.5372549 0.4431373 0.4313725 0.3607843 0.3686275
## [,106] [,107] [,108] [,109] [,110] [,111] [,112]
## [1,] 0.3921569 0.3568627 0.3215686 0.2862745 0.3098039 0.4235294 0.4823529
## [2,] 0.3529412 0.3333333 0.3450980 0.3803922 0.4666667 0.6235294 0.6980392
## [3,] 0.3843137 0.3490196 0.3764706 0.4470588 0.5647059 0.7215686 0.7921569
## [4,] 0.3490196 0.3607843 0.4470588 0.5607843 0.6705882 0.7843137 0.8039216
## [5,] 0.3372549 0.4000000 0.5333333 0.6705882 0.7568627 0.8117647 0.7882353
## [6,] 0.3960784 0.4078431 0.4980392 0.6156863 0.7058824 0.7764706 0.7647059
## [,113] [,114] [,115] [,116] [,117] [,118] [,119]
## [1,] 0.5294118 0.6039216 0.6039216 0.5215686 0.5098039 0.4627451 0.3686275
## [2,] 0.7725490 0.8313725 0.8313725 0.7450980 0.6862745 0.5764706 0.4313725
## [3,] 0.7843137 0.8117647 0.8313725 0.8078431 0.7882353 0.6823529 0.5176471
## [4,] 0.8078431 0.7882353 0.8039216 0.8235294 0.8352941 0.7372549 0.5686275
## [5,] 0.7725490 0.7450980 0.7764706 0.7843137 0.7490196 0.6313725 0.4745098
## [6,] 0.7764706 0.7764706 0.8274510 0.8078431 0.7176471 0.5921569 0.4784314
## [,120] [,121] [,122] [,123] [,124] [,125] [,126]
## [1,] 0.3882353 0.3686275 0.3686275 0.3725490 0.3843137 0.3921569 0.4039216
## [2,] 0.4274510 0.4117647 0.4039216 0.3960784 0.4078431 0.4745098 0.5843137
## [3,] 0.4980392 0.3764706 0.4078431 0.4392157 0.4823529 0.5647059 0.6745098
## [4,] 0.5254902 0.4705882 0.4705882 0.4470588 0.4392157 0.5215686 0.6588235
## [5,] 0.4392157 0.4352941 0.4117647 0.3607843 0.3529412 0.4666667 0.6588235
## [6,] 0.4627451 0.4235294 0.4235294 0.4313725 0.4862745 0.6274510 0.7843137
## [,127] [,128] [,129] [,130] [,131] [,132] [,133]
## [1,] 0.4196078 0.4313725 0.4431373 0.4862745 0.4666667 0.4470588 0.3921569
## [2,] 0.6862745 0.7411765 0.7333333 0.7529412 0.7019608 0.6431373 0.5529412
## [3,] 0.7372549 0.7450980 0.7764706 0.7921569 0.7215686 0.6196078 0.4901961
## [4,] 0.7490196 0.7607843 0.8000000 0.7960784 0.7058824 0.6078431 0.4941176
## [5,] 0.7921569 0.8313725 0.8666667 0.8392157 0.7333333 0.6431373 0.5411765
## [6,] 0.8705882 0.8784314 0.8980392 0.9058824 0.8156863 0.6980392 0.5568627
## [,134] [,135] [,136] [,137] [,138] [,139] [,140]
## [1,] 0.3490196 0.3607843 0.3490196 0.3764706 0.3803922 0.4235294 0.4588235
## [2,] 0.4509804 0.4000000 0.3411765 0.3450980 0.3568627 0.3960784 0.4745098
## [3,] 0.3843137 0.3686275 0.3490196 0.3647059 0.3764706 0.3647059 0.4235294
## [4,] 0.4156863 0.4196078 0.4078431 0.3333333 0.3725490 0.3529412 0.4117647
## [5,] 0.4470588 0.4039216 0.3450980 0.3098039 0.3647059 0.3647059 0.4509804
## [6,] 0.4549020 0.4509804 0.4431373 0.3882353 0.4039216 0.3921569 0.4745098
## [,141] [,142] [,143] [,144] [,145] [,146] [,147]
## [1,] 0.4549020 0.4941176 0.6078431 0.7058824 0.7607843 0.7137255 0.6745098
## [2,] 0.5725490 0.6509804 0.7215686 0.7764706 0.7960784 0.7725490 0.7607843
## [3,] 0.5843137 0.7019608 0.7490196 0.7882353 0.8470588 0.8431373 0.8588235
## [4,] 0.6156863 0.7607843 0.8039216 0.8431373 0.8431373 0.8392157 0.8431373
## [5,] 0.6705882 0.8078431 0.8039216 0.7960784 0.8000000 0.7843137 0.7490196
## [6,] 0.6705882 0.8000000 0.7960784 0.7647059 0.7882353 0.7725490 0.7098039
## [,148] [,149] [,150] [,151] [,152] [,153] [,154]
## [1,] 0.5843137 0.3529412 0.3294118 0.3490196 0.3098039 0.3098039 0.3568627
## [2,] 0.6862745 0.4392157 0.3764706 0.3647059 0.3294118 0.3411765 0.3450980
## [3,] 0.8078431 0.5568627 0.4588235 0.4235294 0.3960784 0.3176471 0.3294118
## [4,] 0.8000000 0.5725490 0.4705882 0.4235294 0.4117647 0.4156863 0.4196078
## [5,] 0.6980392 0.5215686 0.4588235 0.4274510 0.4274510 0.4549020 0.4509804
## [6,] 0.6549020 0.5333333 0.5333333 0.5333333 0.5450980 0.4705882 0.4313725
## [,155] [,156] [,157] [,158] [,159] [,160] [,161]
## [1,] 0.3450980 0.3058824 0.2784314 0.3647059 0.5294118 0.5764706 0.6392157
## [2,] 0.3450980 0.3803922 0.3843137 0.4509804 0.6196078 0.7137255 0.7764706
## [3,] 0.3450980 0.4000000 0.4235294 0.4901961 0.6549020 0.7333333 0.8000000
## [4,] 0.3607843 0.3098039 0.3176471 0.4666667 0.6862745 0.7686275 0.8549020
## [5,] 0.3725490 0.3019608 0.2941176 0.4392157 0.6627451 0.7529412 0.8078431
## [6,] 0.3725490 0.3647059 0.3686275 0.4549020 0.6588235 0.7725490 0.8000000
## [,162] [,163] [,164] [,165] [,166] [,167] [,168]
## [1,] 0.6470588 0.6549020 0.6392157 0.5725490 0.4705882 0.4000000 0.3803922
## [2,] 0.7764706 0.7568627 0.7215686 0.6470588 0.5058824 0.3921569 0.3647059
## [3,] 0.8392157 0.8431373 0.8156863 0.7294118 0.5411765 0.3960784 0.3882353
## [4,] 0.8862745 0.8509804 0.7647059 0.6392157 0.4588235 0.3764706 0.4352941
## [5,] 0.8274510 0.8039216 0.7333333 0.6196078 0.4745098 0.4000000 0.4274510
## [6,] 0.7803922 0.7607843 0.7176471 0.6392157 0.5450980 0.4627451 0.4039216
## [,169] [,170] [,171] [,172] [,173] [,174] [,175]
## [1,] 0.3607843 0.2862745 0.2745098 0.2784314 0.3411765 0.4470588 0.4823529
## [2,] 0.3215686 0.3098039 0.3450980 0.3529412 0.4235294 0.5843137 0.7019608
## [3,] 0.3921569 0.3686275 0.3647059 0.3568627 0.4666667 0.6705882 0.7843137
## [4,] 0.4666667 0.4352941 0.4000000 0.3803922 0.5215686 0.7333333 0.8156863
## [5,] 0.5372549 0.5372549 0.4941176 0.4352941 0.5254902 0.6705882 0.7058824
## [6,] 0.3647059 0.3764706 0.3686275 0.3921569 0.5725490 0.7411765 0.7607843
## [,176] [,177] [,178] [,179] [,180] [,181] [,182]
## [1,] 0.4862745 0.5098039 0.5490196 0.5372549 0.5529412 0.4901961 0.3372549
## [2,] 0.7764706 0.7490196 0.7137255 0.6000000 0.5372549 0.4862745 0.4117647
## [3,] 0.8470588 0.8862745 0.8431373 0.6980392 0.5490196 0.4392157 0.4156863
## [4,] 0.8509804 0.8392157 0.8156863 0.7098039 0.5647059 0.4235294 0.3921569
## [5,] 0.7411765 0.7803922 0.7411765 0.6549020 0.5686275 0.4588235 0.4000000
## [6,] 0.7921569 0.7450980 0.7333333 0.6549020 0.5725490 0.4627451 0.3803922
## [,183] [,184] [,185] [,186] [,187] [,188] [,189]
## [1,] 0.3058824 0.3647059 0.4745098 0.4627451 0.4470588 0.4549020 0.4352941
## [2,] 0.3921569 0.3803922 0.3019608 0.3607843 0.3607843 0.3921569 0.5098039
## [3,] 0.4431373 0.3921569 0.3450980 0.3098039 0.2313725 0.3333333 0.5686275
## [4,] 0.4156863 0.3333333 0.3137255 0.3411765 0.3333333 0.5058824 0.7490196
## [5,] 0.3686275 0.2549020 0.2980392 0.4470588 0.4627451 0.5294118 0.7019608
## [6,] 0.3529412 0.2862745 0.2352941 0.3607843 0.4078431 0.5568627 0.7529412
## [,190] [,191] [,192] [,193] [,194] [,195] [,196]
## [1,] 0.4862745 0.6039216 0.6196078 0.6039216 0.6588235 0.6117647 0.3843137
## [2,] 0.6862745 0.8156863 0.7882353 0.8392157 0.7333333 0.6352941 0.5098039
## [3,] 0.7450980 0.8352941 0.8470588 0.7725490 0.6980392 0.6392157 0.5333333
## [4,] 0.8000000 0.7843137 0.8000000 0.8627451 0.7372549 0.5725490 0.3960784
## [5,] 0.7686275 0.7960784 0.8392157 0.7686275 0.7058824 0.6274510 0.5254902
## [6,] 0.7725490 0.7411765 0.7568627 0.8156863 0.7803922 0.6392157 0.4823529
## [,197] [,198] [,199] [,200] [,201] [,202] [,203]
## [1,] 0.3450980 0.3803922 0.3098039 0.3960784 0.3764706 0.3803922 0.3843137
## [2,] 0.4862745 0.4313725 0.3058824 0.3764706 0.5019608 0.4235294 0.3137255
## [3,] 0.5058824 0.4901961 0.3921569 0.4078431 0.3764706 0.3843137 0.3725490
## [4,] 0.3686275 0.4352941 0.4039216 0.3764706 0.4392157 0.4117647 0.3843137
## [5,] 0.4627451 0.4392157 0.4235294 0.4509804 0.4784314 0.4196078 0.4274510
## [6,] 0.4431373 0.4941176 0.5490196 0.5960784 0.3647059 0.3137255 0.3372549
## [,204] [,205] [,206] [,207] [,208] [,209] [,210]
## [1,] 0.4274510 0.4941176 0.5098039 0.5098039 0.5294118 0.6117647 0.4431373
## [2,] 0.2941176 0.4156863 0.5686275 0.6862745 0.7647059 0.7764706 0.7215686
## [3,] 0.4078431 0.5176471 0.6235294 0.6980392 0.7450980 0.8235294 0.7960784
## [4,] 0.4352941 0.5490196 0.6392157 0.7019608 0.7647059 0.7921569 0.8274510
## [5,] 0.5960784 0.7921569 0.8392157 0.7843137 0.7568627 0.7686275 0.7686275
## [6,] 0.5176471 0.7294118 0.7960784 0.7725490 0.7647059 0.8196078 0.7490196
## [,211] [,212] [,213] [,214] [,215] [,216] [,217]
## [1,] 0.3960784 0.4627451 0.4588235 0.4196078 0.3764706 0.3137255 0.3019608
## [2,] 0.6313725 0.5372549 0.4392157 0.3529412 0.3294118 0.3686275 0.3254902
## [3,] 0.7372549 0.6941176 0.5803922 0.3529412 0.2745098 0.4156863 0.3764706
## [4,] 0.7372549 0.5843137 0.4980392 0.4431373 0.3843137 0.3529412 0.4862745
## [5,] 0.8039216 0.7647059 0.6156863 0.5098039 0.5058824 0.5215686 0.4823529
## [6,] 0.6431373 0.4980392 0.4470588 0.5647059 0.5843137 0.4235294 0.4039216
## [,218] [,219] [,220] [,221] [,222] [,223] [,224]
## [1,] 0.2784314 0.2823529 0.2980392 0.2941176 0.3882353 0.3333333 0.3490196
## [2,] 0.2666667 0.3215686 0.4117647 0.4509804 0.6156863 0.6549020 0.6745098
## [3,] 0.3843137 0.3803922 0.4784314 0.6352941 0.7372549 0.7058824 0.7803922
## [4,] 0.3803922 0.4235294 0.5764706 0.6823529 0.7882353 0.8156863 0.7686275
## [5,] 0.4274510 0.3019608 0.3725490 0.6470588 0.7529412 0.7764706 0.8627451
## [6,] 0.3529412 0.3921569 0.5568627 0.7568627 0.8156863 0.8196078 0.7254902
## [,225] [,226] [,227] [,228] [,229] [,230] [,231]
## [1,] 0.3372549 0.3294118 0.2980392 0.4588235 0.4313725 0.3725490 0.3529412
## [2,] 0.4980392 0.3843137 0.3254902 0.4235294 0.4823529 0.4431373 0.5098039
## [3,] 0.7098039 0.4980392 0.3803922 0.4627451 0.1960784 0.2862745 0.4627451
## [4,] 0.7568627 0.6039216 0.4941176 0.4196078 0.4274510 0.3568627 0.3921569
## [5,] 0.7725490 0.6000000 0.4039216 0.4196078 0.2705882 0.4039216 0.3647059
## [6,] 0.7019608 0.6509804 0.5294118 0.3803922 0.4313725 0.3764706 0.2941176
## [,232] [,233] [,234] [,235] [,236] [,237] [,238]
## [1,] 0.3764706 0.4196078 0.3843137 0.4274510 0.2627451 0.3058824 0.3568627
## [2,] 0.5450980 0.4235294 0.2862745 0.2666667 0.4117647 0.4352941 0.5372549
## [3,] 0.5333333 0.4274510 0.2392157 0.3960784 0.4313725 0.5098039 0.7372549
## [4,] 0.4000000 0.4000000 0.4823529 0.3450980 0.5921569 0.8039216 0.7411765
## [5,] 0.3254902 0.4392157 0.3529412 0.4117647 0.6588235 0.7882353 0.8078431
## [6,] 0.3176471 0.3686275 0.2823529 0.4117647 0.6862745 0.7607843 0.7764706
## [,239] [,240] [,241] [,242] [,243] [,244] [,245]
## [1,] 0.3254902 0.4078431 0.3215686 0.3960784 0.3607843 0.2980392 0.4588235
## [2,] 0.7529412 0.5725490 0.7490196 0.5803922 0.5098039 0.3843137 0.4274510
## [3,] 0.7176471 0.8823529 0.8431373 0.7843137 0.5725490 0.4039216 0.5137255
## [4,] 0.7176471 0.7960784 0.7921569 0.6588235 0.6627451 0.4274510 0.3921569
## [5,] 0.6980392 0.7490196 0.7686275 0.6941176 0.5725490 0.4980392 0.4862745
## [6,] 0.7843137 0.7647059 0.7843137 0.7490196 0.6431373 0.4039216 0.4941176
## [,246] [,247] [,248] [,249] [,250] [,251] [,252]
## [1,] 0.4117647 0.5372549 0.4470588 0.4784314 0.4470588 0.3372549 0.4117647
## [2,] 0.4823529 0.2901961 0.3215686 0.4000000 0.4117647 0.3843137 0.3490196
## [3,] 0.3176471 0.4666667 0.3490196 0.3725490 0.3529412 0.2823529 0.4941176
## [4,] 0.3843137 0.3019608 0.4509804 0.3960784 0.3647059 0.3529412 0.4549020
## [5,] 0.3372549 0.3529412 0.4078431 0.5098039 0.3411765 0.3137255 0.5333333
## [6,] 0.3764706 0.4941176 0.4274510 0.3764706 0.4117647 0.3607843 0.5647059
## [,253] [,254] [,255] [,256] [,257] [,258] [,259]
## [1,] 0.4862745 0.7058824 0.5215686 0.4392157 0.4000000 0.3686275 0.3843137
## [2,] 0.5568627 0.8235294 0.8117647 0.7098039 0.7294118 0.6862745 0.4588235
## [3,] 0.6000000 0.8549020 0.8156863 0.9098039 0.7882353 0.7803922 0.6588235
## [4,] 0.6196078 0.7450980 0.7647059 0.7960784 0.8000000 0.7529412 0.7137255
## [5,] 0.7019608 0.6705882 0.7019608 0.8392157 0.8823529 0.8392157 0.6196078
## [6,] 0.6901961 0.8549020 0.8274510 0.8196078 0.8156863 0.6745098 0.6000000
## [,260] [,261] [,262] [,263] [,264] [,265] [,266]
## [1,] 0.3215686 0.3607843 0.2980392 0.2823529 0.3568627 0.2666667 0.3490196
## [2,] 0.3764706 0.4588235 0.3333333 0.3137255 0.3058824 0.3411765 0.3137255
## [3,] 0.3411765 0.4156863 0.4352941 0.2705882 0.4549020 0.2431373 0.4470588
## [4,] 0.5294118 0.4039216 0.4588235 0.4196078 0.2313725 0.3254902 0.3725490
## [5,] 0.4039216 0.3647059 0.3960784 0.3568627 0.3333333 0.2196078 0.4862745
## [6,] 0.5019608 0.4313725 0.4313725 0.3372549 0.4352941 0.4156863 0.3450980
## [,267] [,268] [,269] [,270] [,271] [,272] [,273]
## [1,] 0.2784314 0.3411765 0.4156863 0.3529412 0.3647059 0.3607843 0.4549020
## [2,] 0.3647059 0.3294118 0.4392157 0.6117647 0.6078431 0.6862745 0.6823529
## [3,] 0.2117647 0.4156863 0.6862745 0.6470588 0.8196078 0.8156863 0.8039216
## [4,] 0.5098039 0.6588235 0.8156863 0.8862745 0.8392157 0.8392157 0.7686275
## [5,] 0.4666667 0.6313725 0.8588235 0.8196078 0.8000000 0.7764706 0.7411765
## [6,] 0.3803922 0.6235294 0.7803922 0.8000000 0.8352941 0.8078431 0.8039216
## [,274] [,275] [,276] [,277] [,278] [,279] [,280]
## [1,] 0.4862745 0.2666667 0.4156863 0.2823529 0.3333333 0.2705882 0.2980392
## [2,] 0.5843137 0.5725490 0.4705882 0.4117647 0.3098039 0.3568627 0.4392157
## [3,] 0.6313725 0.5333333 0.5215686 0.2980392 0.3921569 0.2470588 0.3882353
## [4,] 0.4745098 0.5450980 0.3372549 0.4156863 0.3568627 0.3725490 0.3372549
## [5,] 0.6039216 0.5450980 0.4313725 0.3450980 0.3960784 0.4000000 0.3725490
## [6,] 0.7294118 0.5843137 0.4392157 0.3294118 0.3607843 0.4078431 0.3647059
## [,281] [,282] [,283] [,284] [,285] [,286] [,287]
## [1,] 0.4862745 0.3450980 0.4156863 0.2588235 0.3215686 0.3960784 0.2392157
## [2,] 0.4549020 0.4666667 0.4117647 0.5764706 0.6117647 0.4980392 0.6156863
## [3,] 0.3294118 0.1882353 0.3960784 0.5254902 0.6745098 0.8705882 0.7960784
## [4,] 0.4235294 0.4392157 0.4980392 0.6705882 0.7333333 0.8000000 0.8862745
## [5,] 0.4039216 0.3176471 0.4862745 0.6509804 0.7372549 0.7725490 0.7450980
## [6,] 0.4039216 0.4000000 0.4431373 0.6745098 0.8039216 0.7568627 0.7725490
## [,288] [,289] [,290] [,291] [,292] [,293] [,294]
## [1,] 0.5803922 0.3058824 0.3803922 0.2862745 0.2941176 0.3803922 0.2470588
## [2,] 0.6980392 0.6588235 0.4313725 0.4431373 0.3921569 0.3568627 0.5215686
## [3,] 0.7607843 0.7098039 0.5607843 0.3647059 0.4117647 0.5333333 0.3607843
## [4,] 0.7333333 0.7568627 0.6313725 0.5215686 0.3960784 0.4117647 0.3882353
## [5,] 0.8274510 0.7333333 0.6117647 0.4666667 0.3411765 0.3725490 0.3490196
## [6,] 0.7647059 0.6627451 0.6117647 0.3764706 0.4117647 0.4941176 0.2352941
## [,295] [,296] [,297] [,298] [,299] [,300] [,301]
## [1,] 0.3490196 0.2509804 0.2117647 0.2588235 0.2627451 0.4392157 0.2235294
## [2,] 0.4196078 0.4274510 0.2941176 0.2705882 0.2862745 0.2666667 0.4823529
## [3,] 0.5019608 0.2313725 0.2823529 0.4196078 0.4392157 0.4862745 0.7215686
## [4,] 0.3019608 0.4313725 0.4823529 0.4745098 0.4941176 0.5372549 0.7529412
## [5,] 0.2901961 0.4431373 0.4274510 0.3215686 0.3647059 0.6627451 0.8666667
## [6,] 0.4313725 0.2352941 0.3450980 0.3450980 0.3098039 0.6666667 0.8078431
## [,302] [,303] [,304] [,305] [,306] [,307] [,308]
## [1,] 0.3960784 0.2901961 0.2627451 0.3725490 0.2784314 0.4784314 0.3764706
## [2,] 0.3882353 0.4313725 0.5843137 0.5686275 0.4431373 0.3137255 0.4666667
## [3,] 0.6274510 0.5607843 0.7019608 0.7764706 0.7882353 0.7215686 0.2000000
## [4,] 0.7490196 0.7803922 0.7568627 0.7529412 0.7176471 0.5568627 0.4039216
## [5,] 0.8823529 0.8274510 0.7019608 0.7686275 0.7803922 0.5803922 0.3450980
## [6,] 0.9137255 0.8549020 0.8392157 0.7686275 0.6941176 0.6549020 0.3294118
## [,309] [,310] [,311] [,312] [,313] [,314] [,315]
## [1,] 0.5254902 0.4156863 0.1215686 0.3725490 0.1254902 0.3921569 0.3176471
## [2,] 0.3058824 0.2901961 0.4431373 0.1843137 0.4666667 0.2901961 0.3098039
## [3,] 0.3019608 0.4078431 0.3529412 0.4470588 0.2980392 0.4235294 0.3764706
## [4,] 0.3490196 0.3137255 0.3333333 0.3921569 0.4196078 0.3921569 0.3098039
## [5,] 0.3058824 0.3372549 0.3568627 0.3686275 0.5333333 0.4196078 0.2627451
## [6,] 0.4862745 0.3764706 0.2039216 0.4078431 0.2823529 0.5882353 0.3137255
## [,316] [,317] [,318] [,319] [,320] [,321] [,322]
## [1,] 0.2705882 0.3725490 0.2235294 0.4431373 0.4627451 0.5019608 0.6784314
## [2,] 0.3411765 0.2235294 0.5176471 0.5372549 0.6588235 0.7568627 0.6901961
## [3,] 0.2901961 0.4901961 0.6823529 0.7686275 0.8156863 0.8352941 0.7372549
## [4,] 0.4156863 0.6352941 0.7803922 0.7921569 0.7921569 0.8039216 0.7607843
## [5,] 0.4470588 0.5960784 0.7176471 0.8509804 0.8352941 0.8196078 0.8509804
## [6,] 0.3882353 0.7647059 0.7450980 0.7098039 0.9176471 0.8078431 0.8000000
## [,323] [,324] [,325] [,326] [,327] [,328] [,329]
## [1,] 0.4274510 0.5137255 0.2745098 0.3960784 0.4470588 0.3294118 0.5490196
## [2,] 0.6705882 0.3686275 0.4078431 0.3176471 0.3647059 0.3294118 0.2588235
## [3,] 0.6470588 0.6078431 0.4392157 0.5333333 0.3254902 0.3294118 0.3647059
## [4,] 0.6823529 0.5647059 0.4470588 0.3411765 0.3647059 0.3176471 0.3372549
## [5,] 0.5725490 0.4313725 0.5098039 0.3882353 0.3294118 0.2823529 0.2509804
## [6,] 0.7294118 0.6352941 0.2862745 0.3764706 0.3803922 0.3921569 0.5529412
## [,330] [,331] [,332] [,333] [,334] [,335] [,336]
## [1,] 0.1882353 0.4039216 0.2117647 0.2705882 0.4862745 0.2941176 0.5176471
## [2,] 0.4549020 0.1529412 0.3137255 0.4117647 0.4078431 0.6862745 0.7882353
## [3,] 0.2313725 0.3686275 0.2666667 0.4745098 0.6078431 0.6901961 0.7098039
## [4,] 0.3921569 0.3137255 0.2588235 0.4901961 0.6392157 0.6862745 0.7725490
## [5,] 0.4156863 0.3411765 0.4313725 0.6392157 0.6509804 0.6352941 0.5921569
## [6,] 0.3294118 0.4078431 0.3254902 0.5058824 0.6941176 0.7176471 0.7921569
## [,337] [,338] [,339] [,340] [,341] [,342] [,343]
## [1,] 0.3372549 0.5019608 0.4549020 0.2784314 0.5137255 0.2235294 0.3137255
## [2,] 0.7647059 0.6431373 0.6274510 0.4784314 0.3137255 0.3490196 0.3490196
## [3,] 0.7647059 0.6745098 0.8196078 0.6392157 0.4078431 0.3254902 0.3843137
## [4,] 0.7725490 0.8470588 0.6784314 0.5333333 0.3019608 0.3294118 0.3568627
## [5,] 0.6627451 0.7450980 0.5882353 0.5098039 0.2745098 0.5098039 0.2509804
## [6,] 0.8235294 0.6392157 0.5098039 0.3411765 0.5647059 0.4235294 0.5294118
## [,344] [,345] [,346] [,347] [,348] [,349] [,350]
## [1,] 0.2235294 0.2784314 0.3882353 0.1490196 0.2862745 0.1333333 0.3098039
## [2,] 0.4117647 0.3803922 0.2862745 0.3921569 0.2470588 0.2862745 0.3686275
## [3,] 0.3294118 0.3647059 0.3686275 0.2470588 0.2627451 0.2666667 0.5137255
## [4,] 0.3137255 0.2901961 0.3411765 0.2509804 0.3411765 0.3686275 0.4980392
## [5,] 0.3529412 0.4156863 0.2274510 0.4823529 0.3098039 0.4313725 0.5607843
## [6,] 0.3058824 0.2078431 0.3843137 0.2039216 0.4588235 0.4117647 0.7137255
## [,351] [,352] [,353] [,354] [,355] [,356] [,357]
## [1,] 0.4117647 0.2941176 0.4745098 0.2901961 0.5215686 0.2196078 0.2980392
## [2,] 0.3254902 0.4941176 0.6156863 0.5960784 0.4745098 0.4274510 0.4039216
## [3,] 0.6549020 0.7686275 0.8156863 0.7647059 0.7960784 0.5960784 0.4196078
## [4,] 0.8941176 0.6980392 0.7921569 0.8588235 0.7098039 0.5490196 0.3647059
## [5,] 0.8431373 0.8431373 0.8470588 0.8666667 0.6588235 0.5568627 0.3647059
## [6,] 0.8078431 0.8392157 0.8509804 0.8392157 0.8078431 0.4941176 0.2901961
## [,358] [,359] [,360] [,361] [,362] [,363] [,364]
## [1,] 0.3686275 0.2627451 0.3137255 0.3254902 0.4392157 0.3019608 0.3254902
## [2,] 0.2823529 0.3411765 0.3960784 0.6039216 0.5294118 0.2862745 0.3137255
## [3,] 0.2980392 0.3803922 0.3725490 0.5176471 0.3607843 0.2000000 0.2313725
## [4,] 0.4588235 0.2823529 0.3686275 0.3803922 0.2980392 0.3137255 0.2784314
## [5,] 0.2235294 0.4666667 0.3490196 0.5176471 0.3843137 0.2862745 0.4117647
## [6,] 0.3882353 0.2196078 0.4078431 0.3372549 0.3058824 0.4313725 0.3411765
## [,365] [,366] [,367] [,368] [,369] [,370] [,371]
## [1,] 0.4000000 0.3450980 0.4352941 0.3137255 0.3333333 0.3254902 0.3764706
## [2,] 0.3098039 0.3725490 0.5254902 0.6196078 0.6000000 0.7254902 0.6196078
## [3,] 0.3647059 0.6470588 0.7725490 0.8352941 0.8980392 0.7529412 0.8156863
## [4,] 0.3607843 0.6627451 0.7333333 0.7843137 0.8274510 0.8666667 0.8235294
## [5,] 0.4039216 0.7960784 0.6941176 0.7725490 0.5960784 0.6862745 0.6666667
## [6,] 0.4823529 0.6078431 0.7294118 0.7607843 0.8392157 0.8156863 0.7294118
## [,372] [,373] [,374] [,375] [,376] [,377] [,378]
## [1,] 0.3450980 0.3686275 0.3725490 0.3568627 0.2156863 0.3058824 0.4274510
## [2,] 0.5098039 0.4705882 0.2980392 0.2980392 0.3921569 0.2784314 0.4352941
## [3,] 0.7960784 0.5450980 0.3450980 0.2509804 0.3725490 0.2823529 0.4196078
## [4,] 0.7176471 0.3764706 0.3176471 0.3686275 0.2235294 0.4000000 0.4352941
## [5,] 0.5254902 0.5372549 0.5176471 0.2470588 0.3843137 0.2784314 0.5607843
## [6,] 0.5294118 0.3137255 0.3843137 0.4392157 0.2941176 0.5137255 0.4196078
## [,379] [,380] [,381] [,382] [,383] [,384] [,385]
## [1,] 0.5137255 0.5686275 0.4823529 0.5529412 0.7019608 0.4941176 0.5764706
## [2,] 0.4156863 0.3568627 0.5215686 0.7294118 0.7764706 0.7411765 0.8078431
## [3,] 0.3960784 0.3450980 0.3803922 0.6549020 0.9411765 0.8549020 0.7843137
## [4,] 0.5686275 0.3725490 0.2862745 0.6078431 0.8117647 0.8666667 0.8509804
## [5,] 0.4196078 0.3058824 0.4784314 0.5372549 0.5843137 0.6980392 0.7254902
## [6,] 0.4274510 0.3686275 0.4235294 0.6745098 0.7960784 0.8156863 0.6431373
## [,386] [,387] [,388] [,389] [,390] [,391] [,392]
## [1,] 0.4784314 0.4901961 0.7058824 0.7411765 0.5058824 0.3215686 0.3019608
## [2,] 0.6862745 0.8000000 0.7215686 0.4823529 0.4470588 0.4941176 0.3333333
## [3,] 0.7882353 0.7607843 0.7137255 0.4156863 0.4627451 0.3529412 0.3411765
## [4,] 0.8980392 0.7843137 0.6470588 0.5960784 0.4352941 0.3098039 0.3921569
## [5,] 0.8549020 0.6941176 0.6470588 0.3411765 0.3921569 0.3607843 0.3764706
## [6,] 0.7529412 0.8549020 0.7450980 0.5254902 0.4666667 0.5098039 0.3568627
## [,393] [,394] [,395] [,396] [,397] [,398] [,399]
## [1,] 0.3215686 0.4862745 0.5686275 0.3882353 0.3215686 0.2980392 0.3607843
## [2,] 0.4235294 0.4156863 0.3098039 0.3529412 0.3411765 0.4431373 0.5882353
## [3,] 0.3960784 0.2627451 0.3882353 0.2509804 0.3137255 0.6000000 0.7176471
## [4,] 0.2666667 0.2941176 0.3215686 0.3058824 0.2352941 0.6627451 0.7490196
## [5,] 0.5411765 0.2980392 0.3176471 0.1843137 0.3921569 0.7137255 0.7411765
## [6,] 0.3411765 0.4274510 0.1882353 0.2705882 0.2941176 0.4823529 0.7529412
## [,400] [,401] [,402] [,403] [,404] [,405] [,406]
## [1,] 0.3294118 0.3333333 0.5529412 0.4470588 0.2823529 0.3254902 0.3254902
## [2,] 0.5176471 0.6823529 0.7098039 0.6549020 0.4627451 0.2588235 0.4980392
## [3,] 0.6784314 0.8196078 0.8274510 0.7568627 0.5372549 0.4784314 0.3607843
## [4,] 0.8000000 0.7921569 0.7725490 0.7137255 0.5098039 0.3568627 0.5411765
## [5,] 0.8509804 0.8431373 0.7019608 0.8509804 0.7960784 0.5529412 0.4980392
## [6,] 0.8470588 0.8980392 0.8352941 0.7372549 0.6117647 0.5098039 0.4509804
## [,407] [,408] [,409] [,410] [,411] [,412] [,413]
## [1,] 0.4509804 0.3960784 0.3215686 0.2431373 0.3019608 0.3372549 0.3098039
## [2,] 0.3686275 0.3607843 0.2039216 0.3490196 0.4156863 0.3333333 0.6274510
## [3,] 0.5607843 0.2470588 0.3725490 0.3647059 0.2941176 0.4470588 0.3921569
## [4,] 0.3254902 0.4235294 0.3098039 0.4235294 0.4941176 0.4196078 0.6588235
## [5,] 0.5647059 0.3372549 0.4392157 0.4588235 0.4862745 0.4509804 0.3764706
## [6,] 0.4352941 0.4196078 0.4627451 0.4627451 0.3725490 0.3019608 0.3607843
## [,414] [,415] [,416] [,417] [,418] [,419] [,420]
## [1,] 0.4588235 0.4117647 0.3176471 0.3333333 0.3176471 0.4156863 0.3450980
## [2,] 0.4823529 0.5607843 0.4627451 0.4000000 0.5254902 0.5333333 0.5529412
## [3,] 0.7176471 0.8705882 0.7803922 0.6980392 0.6196078 0.7490196 0.5960784
## [4,] 0.8627451 0.7019608 0.7803922 0.7764706 0.8509804 0.7843137 0.7529412
## [5,] 0.8156863 0.7019608 0.8627451 0.7490196 0.9137255 0.8117647 0.6156863
## [6,] 0.6549020 0.7921569 0.8431373 0.9254902 0.8000000 0.7450980 0.5843137
## [,421] [,422] [,423] [,424] [,425] [,426] [,427]
## [1,] 0.3568627 0.6274510 0.2745098 0.3882353 0.2235294 0.3568627 0.3529412
## [2,] 0.4039216 0.4313725 0.3215686 0.2784314 0.3725490 0.2392157 0.3254902
## [3,] 0.4627451 0.5725490 0.3647059 0.4156863 0.1686275 0.3725490 0.2705882
## [4,] 0.4627451 0.2941176 0.4274510 0.2549020 0.3921569 0.3098039 0.2431373
## [5,] 0.5882353 0.4666667 0.4078431 0.5176471 0.3764706 0.3843137 0.2980392
## [6,] 0.4039216 0.4392157 0.4980392 0.3843137 0.3490196 0.3647059 0.3176471
## [,428] [,429] [,430] [,431] [,432] [,433] [,434]
## [1,] 0.2823529 0.5176471 0.3372549 0.5294118 0.3490196 0.4745098 0.6196078
## [2,] 0.3960784 0.3725490 0.5490196 0.7921569 0.7764706 0.7647059 0.7647059
## [3,] 0.3529412 0.7372549 0.7686275 0.8196078 0.7607843 0.8039216 0.7607843
## [4,] 0.4352941 0.5254902 0.7529412 0.7450980 0.9215686 0.8627451 0.8392157
## [5,] 0.4196078 0.5333333 0.7098039 0.5725490 0.7568627 0.8156863 0.7686275
## [6,] 0.3098039 0.5137255 0.6862745 0.8313725 0.6313725 0.7529412 0.7450980
## [,435] [,436] [,437] [,438] [,439] [,440] [,441]
## [1,] 0.6039216 0.5764706 0.2666667 0.3725490 0.3215686 0.4039216 0.6352941
## [2,] 0.6666667 0.4274510 0.4745098 0.3137255 0.2705882 0.3960784 0.2117647
## [3,] 0.7882353 0.5803922 0.3137255 0.3490196 0.3921569 0.2470588 0.3843137
## [4,] 0.7215686 0.4588235 0.4784314 0.3882353 0.3372549 0.3647059 0.3176471
## [5,] 0.8000000 0.5568627 0.3882353 0.3215686 0.4039216 0.3686275 0.3843137
## [6,] 0.7098039 0.5098039 0.3960784 0.4823529 0.4431373 0.2627451 0.3921569
## [,442] [,443] [,444] [,445] [,446] [,447] [,448]
## [1,] 0.2901961 0.4627451 0.2117647 0.2156863 0.4862745 0.4627451 0.5137255
## [2,] 0.4588235 0.2588235 0.3372549 0.4000000 0.3725490 0.5529412 0.6509804
## [3,] 0.1803922 0.3607843 0.2392157 0.3019608 0.5372549 0.7882353 0.7490196
## [4,] 0.4039216 0.3215686 0.2784314 0.4000000 0.5254902 0.6941176 0.8549020
## [5,] 0.4274510 0.4784314 0.4549020 0.5372549 0.6039216 0.6705882 0.9176471
## [6,] 0.1294118 0.4901961 0.3098039 0.3921569 0.6980392 0.7372549 0.7215686
## [,449] [,450] [,451] [,452] [,453] [,454] [,455]
## [1,] 0.4235294 0.5960784 0.6117647 0.3843137 0.4705882 0.2392157 0.3686275
## [2,] 0.5960784 0.5647059 0.6666667 0.7803922 0.4745098 0.4941176 0.2980392
## [3,] 0.7960784 0.7607843 0.6156863 0.6862745 0.6235294 0.3529412 0.6431373
## [4,] 0.7960784 0.8078431 0.8039216 0.5921569 0.3725490 0.3137255 0.2784314
## [5,] 0.8862745 0.7568627 0.8000000 0.5529412 0.4274510 0.3647059 0.2980392
## [6,] 0.7921569 0.8078431 0.8862745 0.6941176 0.5254902 0.1490196 0.3764706
## [,456] [,457] [,458] [,459] [,460] [,461] [,462]
## [1,] 0.2588235 0.2941176 0.3803922 0.2274510 0.2941176 0.2823529 0.3725490
## [2,] 0.4431373 0.4745098 0.2862745 0.3019608 0.2980392 0.4000000 0.4705882
## [3,] 0.4745098 0.3294118 0.3254902 0.1803922 0.2901961 0.5411765 0.6980392
## [4,] 0.3568627 0.2352941 0.2941176 0.3490196 0.3960784 0.6392157 0.7411765
## [5,] 0.4039216 0.3960784 0.4156863 0.5098039 0.4196078 0.5803922 0.8117647
## [6,] 0.2431373 0.3137255 0.5019608 0.1686275 0.3411765 0.5058824 0.6392157
## [,463] [,464] [,465] [,466] [,467] [,468] [,469]
## [1,] 0.4078431 0.2980392 0.4823529 0.3019608 0.4509804 0.3607843 0.3294118
## [2,] 0.6705882 0.6470588 0.7960784 0.6745098 0.6666667 0.6509804 0.3764706
## [3,] 0.8274510 1.0000000 0.8705882 0.8980392 0.8392157 0.6509804 0.3450980
## [4,] 0.8431373 0.8313725 0.8352941 0.7960784 0.8509804 0.5764706 0.4431373
## [5,] 0.7333333 0.7960784 0.7411765 0.7294118 0.8235294 0.7294118 0.7098039
## [6,] 0.7294118 0.8431373 0.7882353 0.6549020 0.8000000 0.4862745 0.4431373
## [,470] [,471] [,472] [,473] [,474] [,475] [,476]
## [1,] 0.5254902 0.1764706 0.3019608 0.1725490 0.2509804 0.3372549 0.2196078
## [2,] 0.3019608 0.4392157 0.2392157 0.3921569 0.2313725 0.2745098 0.4000000
## [3,] 0.4823529 0.3686275 0.4470588 0.2666667 0.3176471 0.2941176 0.3529412
## [4,] 0.4156863 0.3254902 0.3803922 0.3019608 0.2901961 0.3333333 0.3215686
## [5,] 0.4000000 0.2980392 0.2862745 0.4313725 0.4235294 0.3176471 0.4078431
## [6,] 0.5215686 0.2470588 0.4745098 0.3019608 0.3254902 0.3764706 0.2941176
## [,477] [,478] [,479] [,480] [,481] [,482] [,483]
## [1,] 0.5215686 0.3803922 0.5019608 0.5803922 0.5529412 0.5882353 0.5058824
## [2,] 0.4117647 0.6509804 0.7647059 0.7843137 0.7372549 0.8392157 0.7490196
## [3,] 0.5137255 0.6352941 0.8705882 0.9176471 0.8823529 0.9568627 0.8431373
## [4,] 0.4078431 0.6745098 0.6901961 0.7098039 0.7921569 0.7725490 0.7294118
## [5,] 0.4117647 0.5019608 0.7411765 0.8705882 0.8431373 0.7333333 0.7568627
## [6,] 0.5058824 0.7764706 0.7725490 0.6705882 0.7294118 0.6705882 0.6862745
## [,484] [,485] [,486] [,487] [,488] [,489] [,490]
## [1,] 0.5686275 0.4078431 0.2862745 0.3098039 0.2588235 0.4666667 0.3960784
## [2,] 0.6431373 0.4627451 0.4117647 0.3215686 0.3372549 0.2392157 0.4784314
## [3,] 0.7058824 0.4549020 0.3725490 0.3254902 0.3058824 0.5019608 0.4470588
## [4,] 0.6705882 0.5411765 0.4117647 0.4196078 0.4392157 0.4470588 0.4078431
## [5,] 0.5686275 0.6627451 0.5764706 0.4627451 0.6666667 0.2823529 0.4117647
## [6,] 0.7254902 0.5843137 0.3568627 0.5215686 0.2274510 0.4313725 0.3098039
## [,491] [,492] [,493] [,494] [,495] [,496] [,497]
## [1,] 0.4823529 0.5568627 0.3686275 0.4313725 0.4274510 0.5137255 0.5647059
## [2,] 0.3254902 0.2705882 0.3490196 0.6000000 0.7333333 0.8117647 0.6627451
## [3,] 0.3843137 0.3333333 0.4470588 0.7176471 0.6980392 0.8941176 0.7450980
## [4,] 0.3333333 0.4039216 0.5294118 0.7882353 0.8274510 0.7254902 0.8235294
## [5,] 0.3137255 0.3254902 0.6000000 0.8431373 0.8039216 0.7450980 0.7098039
## [6,] 0.4274510 0.4666667 0.5568627 0.7647059 0.7490196 0.7882353 0.8627451
## [,498] [,499] [,500] [,501] [,502] [,503] [,504]
## [1,] 0.4274510 0.3686275 0.2470588 0.2980392 0.3176471 0.2509804 0.3215686
## [2,] 0.5725490 0.4705882 0.4274510 0.3098039 0.2980392 0.2588235 0.2901961
## [3,] 0.7568627 0.4470588 0.4705882 0.3333333 0.4627451 0.3176471 0.3058824
## [4,] 0.7647059 0.6627451 0.4705882 0.4784314 0.3176471 0.3254902 0.3529412
## [5,] 0.7725490 0.8039216 0.4980392 0.2941176 0.4235294 0.3843137 0.1882353
## [6,] 0.8431373 0.7647059 0.4627451 0.5764706 0.4549020 0.3098039 0.4039216
## [,505] [,506] [,507] [,508] [,509] [,510] [,511]
## [1,] 0.2627451 0.3176471 0.2352941 0.3019608 0.3803922 0.2941176 0.2941176
## [2,] 0.4117647 0.2470588 0.2862745 0.3411765 0.3019608 0.3607843 0.4509804
## [3,] 0.3803922 0.2745098 0.3450980 0.2941176 0.4274510 0.6196078 0.5764706
## [4,] 0.2823529 0.3921569 0.3215686 0.3254902 0.5058824 0.6274510 0.6784314
## [5,] 0.3686275 0.1686275 0.4588235 0.4078431 0.3137255 0.6156863 0.6862745
## [6,] 0.2352941 0.4549020 0.2039216 0.3568627 0.4431373 0.3568627 0.7411765
## [,512]
## [1,] 0.3568627
## [2,] 0.4784314
## [3,] 0.7411765
## [4,] 0.7098039
## [5,] 0.7137255
## [6,] 0.8196078
length(pixel_values)
## [1] 262144
# Plot the histogram
hist(pixel_values, main = "Pixel Value Histogram", xlab = "Pixel Value", ylab = "Frequency", col = "lightblue", border = "black")
After plotting the data, we tried to fit the data to Normal distribution but it failed. Then we proceed with the Bimodal Distribution.
# Check normality, it fails
sample <- sample(pixel_values,1000,replace = FALSE)
shapiro.test(sample)
##
## Shapiro-Wilk normality test
##
## data: sample
## W = 0.91674, p-value < 2.2e-16
# Fit the pixel values to a bimodal distribution
fit_result <- normalmixEM(pixel_values, k = 2) # 'k' specifies the number of components in the mixture model
## number of iterations= 53
# Part1.2
# Extract mean and variance for each mode
mean_mode1 <- fit_result$mu[1]
variance_mode1 <- fit_result$sigma[1]^2
mean_mode2 <- fit_result$mu[2]
variance_mode2 <- fit_result$sigma[2]^2
# Check the bimodal distribution
x_values <- seq(min(pixel_values), max(pixel_values), length.out = 1000)
# Calculate PDF values for each mode
pdf_mode1 <- dnorm(x_values, mean = mean_mode1, sd = sqrt(variance_mode1))
pdf_mode2 <- dnorm(x_values, mean = mean_mode2, sd = sqrt(variance_mode2))
# Combine the PDFs for the bimodal distribution
pdf_bimodal <- 0.5 * pdf_mode1 + 0.5 * pdf_mode2
# Plot the bimodal distribution
plot(x_values, pdf_bimodal, type = "l", col = "blue", lwd = 2, ylab = "Probability Density", xlab = "Pixel Values", main = "Bimodal Distribution Fit")
lines(x_values, 0.5 * pdf_mode1, col = "red", lty = 2, lwd = 2) # Plot mode 1
lines(x_values, 0.5 * pdf_mode2, col = "green", lty = 2, lwd = 2) # Plot mode 2
legend("topright", legend = c("Bimodal Distribution", "Mode 1", "Mode 2"), col = c("blue", "red", "green"), lty = c(1, 2, 2), lwd = 2)
After finding the distribution, limits to detect the outliers are determined. After that, the values lying outside the limits are selected and painted to black (decreased their value to 0).
#Part 1.3: Outlier detection
# Calculate lower and upper bounds for 0.001 probability limits
lower_bound <- qnorm(0.001, mean_mode1, sqrt(variance_mode1))
upper_bound <- qnorm(0.999, mean_mode2, sqrt(variance_mode2))
# Identify pixels outside the bounds
# Identify pixels outside the bounds and get their indices
outlier_indices <- which(pixel_values < lower_bound | pixel_values > upper_bound)
outlier_indices
## [1] 121050 129547 129571 129845 131879 132801 133710 137582 139854 146831
## [11] 154148 158721 159527 159745 160592 163101 165676 166765 167674 168439
## [21] 173147 174195 174363 175824 177143 178509 179286 179420 182899 184922
## [31] 185877 186903 189451 191090 192810 194940 196159 196826 197222 197735
## [41] 200283 203759 205357 205643 206542 207475 207773 208066 208286 209078
## [51] 210165 211467 211892 213917 214606 214999 215620 215947 218183 220129
## [61] 223535 224427 224576 227043 228463 230771 232381 233146 234087 236524
## [71] 245053 251238 251507 252428 253750 255091 256461 257656
img_outliers_removed<- img
img_outliers_removed[outlier_indices] <- 0
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(img, 0, 0, 512, 512)
# Add titles to the plots
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# New Image with Outliers Removed
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(img_outliers_removed, 0, 0, 512, 512)
title(main="Without Outliers", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
Although this method finds some outliers, resulting image shows us that the current method is not sufficient to detect the parts we need.
# Part 1.4: Image Operations on Patches
# Define window size
window_size <- 51
# Update the operate_on_patches function
operate_on_patches <- function(image, window_size) {
# Get the dimensions of the image
dimensions <- dim(image)
print(dimensions)
# Extract the number of rows (assuming the image is a matrix)
x <- dimensions[1]
# Calculate the number of patches in each dimension
n_of_patch <- x %/% window_size
print(n_of_patch)
# Iterate over each patch
for (i in 1:n_of_patch) {
for (j in 1:n_of_patch) {
# Calculate the indices for the current patch
row_indices <- (window_size * (i - 1) + 1):(window_size * i)
col_indices <- (window_size * (j - 1) + 1):(window_size * j)
# Ensure indices do not go out of bounds
row_indices <- row_indices[row_indices <= x]
col_indices <- col_indices[col_indices <= x]
# Extract the current patch from the image
patch <- image[row_indices, col_indices]
# Fit a bimodal normal distribution to the current patch
patch_fit_result <- normalmixEM(patch, k = 2)
# Extract mean and variance for each mode
patch_mean_mode1 <- patch_fit_result$mu[1]
patch_variance_mode1 <- patch_fit_result$sigma[1]^2
patch_mean_mode2 <- patch_fit_result$mu[2]
patch_variance_mode2 <- patch_fit_result$sigma[2]^2
# Calculate lower and upper bounds for 0.001 probability limits
patch_lower_bound <- qnorm(0.001, patch_mean_mode1, sqrt(patch_variance_mode1))
patch_upper_bound <- qnorm(0.999, patch_mean_mode2, sqrt(patch_variance_mode2))
# Threshold the pixel values in the patch based on probability limits
patch[patch < patch_lower_bound | patch > patch_upper_bound] <- 0
# Update the original image with the modified patch
image[row_indices, col_indices] <- patch
}
}
# Return the modified image
return(image)
}
patch_img = operate_on_patches(img,window_size)
## [1] 512 512
## [1] 10
## number of iterations= 119
## number of iterations= 154
## number of iterations= 117
## number of iterations= 122
## number of iterations= 53
## number of iterations= 50
## number of iterations= 104
## number of iterations= 69
## number of iterations= 88
## number of iterations= 87
## number of iterations= 123
## number of iterations= 77
## number of iterations= 89
## number of iterations= 104
## number of iterations= 76
## number of iterations= 98
## number of iterations= 87
## number of iterations= 84
## number of iterations= 58
## number of iterations= 58
## number of iterations= 177
## number of iterations= 119
## number of iterations= 118
## number of iterations= 105
## number of iterations= 59
## number of iterations= 114
## number of iterations= 69
## number of iterations= 79
## number of iterations= 84
## number of iterations= 71
## number of iterations= 103
## number of iterations= 93
## number of iterations= 103
## number of iterations= 88
## number of iterations= 86
## number of iterations= 95
## number of iterations= 107
## number of iterations= 94
## number of iterations= 94
## number of iterations= 70
## number of iterations= 135
## number of iterations= 95
## number of iterations= 82
## number of iterations= 99
## number of iterations= 97
## number of iterations= 97
## number of iterations= 71
## number of iterations= 58
## number of iterations= 95
## number of iterations= 59
## number of iterations= 101
## number of iterations= 117
## number of iterations= 119
## number of iterations= 101
## number of iterations= 88
## number of iterations= 86
## number of iterations= 41
## number of iterations= 60
## number of iterations= 53
## number of iterations= 52
## number of iterations= 60
## number of iterations= 79
## number of iterations= 102
## number of iterations= 105
## number of iterations= 81
## number of iterations= 86
## number of iterations= 57
## number of iterations= 122
## number of iterations= 91
## number of iterations= 68
## number of iterations= 113
## number of iterations= 159
## number of iterations= 73
## number of iterations= 85
## number of iterations= 84
## number of iterations= 83
## number of iterations= 69
## number of iterations= 94
## number of iterations= 65
## number of iterations= 70
## number of iterations= 99
## number of iterations= 107
## number of iterations= 105
## number of iterations= 81
## number of iterations= 105
## number of iterations= 96
## number of iterations= 75
## number of iterations= 59
## number of iterations= 63
## number of iterations= 96
## number of iterations= 104
## number of iterations= 92
## number of iterations= 95
## number of iterations= 66
## number of iterations= 88
## number of iterations= 85
## number of iterations= 66
## number of iterations= 105
## number of iterations= 39
## number of iterations= 78
# Display the original and new images in a plot
par(mfrow = c(1, 2))
# Original Image
plot(1, type = 'n', xlab = '', ylab = '', xlim = c(0, 512), ylim = c(0, 512))
rasterImage(img, 0, 0, 512, 512)
title(main = "Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# New Image with Outliers Removed in Patches
plot(1, type = 'n', xlab = '', ylab = '', xlim = c(0, 512), ylim = c(0, 512))
rasterImage(patch_img, 0, 0, 512, 512)
title(main = "Without Outliers in Patches", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Reset the plot layout
par(mfrow = c(1, 1))
In part 1.4, we divided our data into small samples. Patches of 51x51 pixels are used to determine mean, variance, upper and lower limits. Results shows us that the function found 4 problematic patches. In only one of them, there was a problem. It might be considered as a success but the accuracy is not good.
A Simple Defect Detection Approach from a Control Chart Perspective:
In this part, there is a assumption that every row’s and column’s distribution is same. Therefore, the first column and the row of the image is selected and the upper and lower limits are determined by fitting the distributions.
# Part 2.1
# Read the color image
img <- readJPEG("~/Desktop/Dersler/IE423/outputimage.jpg")
# Define second image
part2_img = img
# Assuming all the rows have the same distribution of pixels
row1 = img[1,]
head(row1)
## [1] 0.7490196 0.7490196 0.6980392 0.6117647 0.5294118 0.4274510
# Display the distribution of row
hist(row1, main = "Pixel Value Histogram", xlab = "Pixel Value", ylab = "Frequency", col = "lightblue", border = "black")
# Check normality, it fails
row1_array = as.array(row1)
sample <- sample(row1,100,replace = FALSE)
shapiro.test(sample)
##
## Shapiro-Wilk normality test
##
## data: sample
## W = 0.95192, p-value = 0.001112
# Fit the pixel values to a bimodal distribution
fit_result <- normalmixEM(row1, k = 2) # 'k' specifies the number of components in the mixture model
## number of iterations= 688
fit_result
## $x
## [1] 0.7490196 0.7490196 0.6980392 0.6117647 0.5294118 0.4274510 0.3490196
## [8] 0.3294118 0.3450980 0.3490196 0.3647059 0.3921569 0.4352941 0.5098039
## [15] 0.6078431 0.6862745 0.7411765 0.7058824 0.6509804 0.6392157 0.5411765
## [22] 0.5058824 0.4274510 0.3764706 0.3764706 0.3450980 0.3215686 0.3372549
## [29] 0.3882353 0.4666667 0.5529412 0.6156863 0.6705882 0.6196078 0.5529412
## [36] 0.4980392 0.4509804 0.4156863 0.4078431 0.4156863 0.4235294 0.4039216
## [43] 0.4196078 0.4509804 0.4901961 0.5764706 0.6666667 0.7019608 0.7333333
## [50] 0.7372549 0.6588235 0.5882353 0.5372549 0.4980392 0.4745098 0.4078431
## [57] 0.4000000 0.3607843 0.3215686 0.3764706 0.5098039 0.6196078 0.6745098
## [64] 0.7215686 0.7215686 0.7529412 0.7450980 0.6509804 0.4862745 0.4235294
## [71] 0.3098039 0.2941176 0.2823529 0.3372549 0.4000000 0.4470588 0.5058824
## [78] 0.6078431 0.7294118 0.8078431 0.7960784 0.7647059 0.6980392 0.5450980
## [85] 0.4666667 0.3529412 0.3372549 0.3411765 0.3960784 0.3843137 0.3764706
## [92] 0.3882353 0.4274510 0.4784314 0.5254902 0.5529412 0.5411765 0.5882353
## [99] 0.5372549 0.4745098 0.4078431 0.3411765 0.3333333 0.3215686 0.3607843
## [106] 0.3921569 0.3568627 0.3215686 0.2862745 0.3098039 0.4235294 0.4823529
## [113] 0.5294118 0.6039216 0.6039216 0.5215686 0.5098039 0.4627451 0.3686275
## [120] 0.3882353 0.3686275 0.3686275 0.3725490 0.3843137 0.3921569 0.4039216
## [127] 0.4196078 0.4313725 0.4431373 0.4862745 0.4666667 0.4470588 0.3921569
## [134] 0.3490196 0.3607843 0.3490196 0.3764706 0.3803922 0.4235294 0.4588235
## [141] 0.4549020 0.4941176 0.6078431 0.7058824 0.7607843 0.7137255 0.6745098
## [148] 0.5843137 0.3529412 0.3294118 0.3490196 0.3098039 0.3098039 0.3568627
## [155] 0.3450980 0.3058824 0.2784314 0.3647059 0.5294118 0.5764706 0.6392157
## [162] 0.6470588 0.6549020 0.6392157 0.5725490 0.4705882 0.4000000 0.3803922
## [169] 0.3607843 0.2862745 0.2745098 0.2784314 0.3411765 0.4470588 0.4823529
## [176] 0.4862745 0.5098039 0.5490196 0.5372549 0.5529412 0.4901961 0.3372549
## [183] 0.3058824 0.3647059 0.4745098 0.4627451 0.4470588 0.4549020 0.4352941
## [190] 0.4862745 0.6039216 0.6196078 0.6039216 0.6588235 0.6117647 0.3843137
## [197] 0.3450980 0.3803922 0.3098039 0.3960784 0.3764706 0.3803922 0.3843137
## [204] 0.4274510 0.4941176 0.5098039 0.5098039 0.5294118 0.6117647 0.4431373
## [211] 0.3960784 0.4627451 0.4588235 0.4196078 0.3764706 0.3137255 0.3019608
## [218] 0.2784314 0.2823529 0.2980392 0.2941176 0.3882353 0.3333333 0.3490196
## [225] 0.3372549 0.3294118 0.2980392 0.4588235 0.4313725 0.3725490 0.3529412
## [232] 0.3764706 0.4196078 0.3843137 0.4274510 0.2627451 0.3058824 0.3568627
## [239] 0.3254902 0.4078431 0.3215686 0.3960784 0.3607843 0.2980392 0.4588235
## [246] 0.4117647 0.5372549 0.4470588 0.4784314 0.4470588 0.3372549 0.4117647
## [253] 0.4862745 0.7058824 0.5215686 0.4392157 0.4000000 0.3686275 0.3843137
## [260] 0.3215686 0.3607843 0.2980392 0.2823529 0.3568627 0.2666667 0.3490196
## [267] 0.2784314 0.3411765 0.4156863 0.3529412 0.3647059 0.3607843 0.4549020
## [274] 0.4862745 0.2666667 0.4156863 0.2823529 0.3333333 0.2705882 0.2980392
## [281] 0.4862745 0.3450980 0.4156863 0.2588235 0.3215686 0.3960784 0.2392157
## [288] 0.5803922 0.3058824 0.3803922 0.2862745 0.2941176 0.3803922 0.2470588
## [295] 0.3490196 0.2509804 0.2117647 0.2588235 0.2627451 0.4392157 0.2235294
## [302] 0.3960784 0.2901961 0.2627451 0.3725490 0.2784314 0.4784314 0.3764706
## [309] 0.5254902 0.4156863 0.1215686 0.3725490 0.1254902 0.3921569 0.3176471
## [316] 0.2705882 0.3725490 0.2235294 0.4431373 0.4627451 0.5019608 0.6784314
## [323] 0.4274510 0.5137255 0.2745098 0.3960784 0.4470588 0.3294118 0.5490196
## [330] 0.1882353 0.4039216 0.2117647 0.2705882 0.4862745 0.2941176 0.5176471
## [337] 0.3372549 0.5019608 0.4549020 0.2784314 0.5137255 0.2235294 0.3137255
## [344] 0.2235294 0.2784314 0.3882353 0.1490196 0.2862745 0.1333333 0.3098039
## [351] 0.4117647 0.2941176 0.4745098 0.2901961 0.5215686 0.2196078 0.2980392
## [358] 0.3686275 0.2627451 0.3137255 0.3254902 0.4392157 0.3019608 0.3254902
## [365] 0.4000000 0.3450980 0.4352941 0.3137255 0.3333333 0.3254902 0.3764706
## [372] 0.3450980 0.3686275 0.3725490 0.3568627 0.2156863 0.3058824 0.4274510
## [379] 0.5137255 0.5686275 0.4823529 0.5529412 0.7019608 0.4941176 0.5764706
## [386] 0.4784314 0.4901961 0.7058824 0.7411765 0.5058824 0.3215686 0.3019608
## [393] 0.3215686 0.4862745 0.5686275 0.3882353 0.3215686 0.2980392 0.3607843
## [400] 0.3294118 0.3333333 0.5529412 0.4470588 0.2823529 0.3254902 0.3254902
## [407] 0.4509804 0.3960784 0.3215686 0.2431373 0.3019608 0.3372549 0.3098039
## [414] 0.4588235 0.4117647 0.3176471 0.3333333 0.3176471 0.4156863 0.3450980
## [421] 0.3568627 0.6274510 0.2745098 0.3882353 0.2235294 0.3568627 0.3529412
## [428] 0.2823529 0.5176471 0.3372549 0.5294118 0.3490196 0.4745098 0.6196078
## [435] 0.6039216 0.5764706 0.2666667 0.3725490 0.3215686 0.4039216 0.6352941
## [442] 0.2901961 0.4627451 0.2117647 0.2156863 0.4862745 0.4627451 0.5137255
## [449] 0.4235294 0.5960784 0.6117647 0.3843137 0.4705882 0.2392157 0.3686275
## [456] 0.2588235 0.2941176 0.3803922 0.2274510 0.2941176 0.2823529 0.3725490
## [463] 0.4078431 0.2980392 0.4823529 0.3019608 0.4509804 0.3607843 0.3294118
## [470] 0.5254902 0.1764706 0.3019608 0.1725490 0.2509804 0.3372549 0.2196078
## [477] 0.5215686 0.3803922 0.5019608 0.5803922 0.5529412 0.5882353 0.5058824
## [484] 0.5686275 0.4078431 0.2862745 0.3098039 0.2588235 0.4666667 0.3960784
## [491] 0.4823529 0.5568627 0.3686275 0.4313725 0.4274510 0.5137255 0.5647059
## [498] 0.4274510 0.3686275 0.2470588 0.2980392 0.3176471 0.2509804 0.3215686
## [505] 0.2627451 0.3176471 0.2352941 0.3019608 0.3803922 0.2941176 0.2941176
## [512] 0.3568627
##
## $lambda
## [1] 0.4356004 0.5643996
##
## $mu
## [1] 0.3411267 0.4779809
##
## $sigma
## [1] 0.06077324 0.13619327
##
## $loglik
## [1] 352.8452
##
## $posterior
## comp.1 comp.2
## [1,] 2.070582e-09 1.0000000
## [2,] 2.070582e-09 1.0000000
## [3,] 2.067084e-07 0.9999998
## [4,] 1.383854e-04 0.9998616
## [5,] 1.506656e-02 0.9849334
## [6,] 4.032123e-01 0.5967877
## [7,] 7.286459e-01 0.2713541
## [8,] 7.547868e-01 0.2452132
## [9,] 7.353117e-01 0.2646883
## [10,] 7.286459e-01 0.2713541
## [11,] 6.939185e-01 0.3060815
## [12,] 5.972235e-01 0.4027765
## [13,] 3.535550e-01 0.6464450
## [14,] 3.638410e-02 0.9636159
## [15,] 1.790040e-04 0.9998210
## [16,] 5.520376e-07 0.9999994
## [17,] 4.361166e-09 1.0000000
## [18,] 1.056111e-07 0.9999999
## [19,] 8.781955e-06 0.9999912
## [20,] 2.079981e-05 0.9999792
## [21,] 8.474069e-03 0.9915259
## [22,] 4.286626e-02 0.9571337
## [23,] 4.032123e-01 0.5967877
## [24,] 6.584833e-01 0.3415167
## [25,] 6.584833e-01 0.3415167
## [26,] 7.353117e-01 0.2646883
## [27,] 7.605290e-01 0.2394710
## [28,] 7.464361e-01 0.2535639
## [29,] 6.140977e-01 0.3859023
## [30,] 1.704783e-01 0.8295217
## [31,] 4.612394e-03 0.9953876
## [32,] 1.066266e-04 0.9998934
## [33,] 1.952121e-06 0.9999980
## [34,] 8.188225e-05 0.9999181
## [35,] 4.612394e-03 0.9953876
## [36,] 5.872020e-02 0.9412798
## [37,] 2.561327e-01 0.7438673
## [38,] 4.750001e-01 0.5249999
## [39,] 5.194702e-01 0.4805298
## [40,] 4.750001e-01 0.5249999
## [41,] 4.276550e-01 0.5723450
## [42,] 5.403917e-01 0.4596083
## [43,] 4.516301e-01 0.5483699
## [44,] 2.561327e-01 0.7438673
## [45,] 7.897220e-02 0.9210278
## [46,] 1.243321e-03 0.9987567
## [47,] 2.654730e-06 0.9999973
## [48,] 1.479987e-07 0.9999999
## [49,] 9.063999e-09 1.0000000
## [50,] 6.297749e-09 1.0000000
## [51,] 4.860744e-06 0.9999951
## [52,] 6.164518e-04 0.9993835
## [53,] 1.030412e-02 0.9896959
## [54,] 5.872020e-02 0.9412798
## [55,] 1.346697e-01 0.8653303
## [56,] 5.194702e-01 0.4805298
## [57,] 5.603504e-01 0.4396496
## [58,] 7.038752e-01 0.2961248
## [59,] 7.605290e-01 0.2394710
## [60,] 6.584833e-01 0.3415167
## [61,] 3.638410e-02 0.9636159
## [62,] 8.188225e-05 0.9999181
## [63,] 1.430687e-06 0.9999986
## [64,] 2.648705e-08 1.0000000
## [65,] 2.648705e-08 1.0000000
## [66,] 1.419597e-09 1.0000000
## [67,] 3.010036e-09 1.0000000
## [68,] 8.781955e-06 0.9999912
## [69,] 9.092726e-02 0.9090727
## [70,] 4.276550e-01 0.5723450
## [71,] 7.644949e-01 0.2355051
## [72,] 7.613322e-01 0.2386678
## [73,] 7.524773e-01 0.2475227
## [74,] 7.464361e-01 0.2535639
## [75,] 5.603504e-01 0.4396496
## [76,] 2.797937e-01 0.7202063
## [77,] 4.286626e-02 0.9571337
## [78,] 1.790040e-04 0.9998210
## [79,] 1.300188e-08 1.0000000
## [80,] 5.071220e-12 1.0000000
## [81,] 1.792162e-11 1.0000000
## [82,] 4.484281e-10 1.0000000
## [83,] 2.067084e-07 0.9999998
## [84,] 6.943719e-03 0.9930563
## [85,] 1.704783e-01 0.8295217
## [86,] 7.212058e-01 0.2787942
## [87,] 7.464361e-01 0.2535639
## [88,] 7.412327e-01 0.2587673
## [89,] 5.793033e-01 0.4206967
## [90,] 6.299251e-01 0.3700749
## [91,] 6.584833e-01 0.3415167
## [92,] 6.140977e-01 0.3859023
## [93,] 4.032123e-01 0.5967877
## [94,] 1.187510e-01 0.8812490
## [95,] 1.811525e-02 0.9818847
## [96,] 4.612394e-03 0.9953876
## [97,] 8.474069e-03 0.9915259
## [98,] 6.164518e-04 0.9993835
## [99,] 1.030412e-02 0.9896959
## [100,] 1.346697e-01 0.8653303
## [101,] 5.194702e-01 0.4805298
## [102,] 7.412327e-01 0.2587673
## [103,] 7.509468e-01 0.2490532
## [104,] 7.605290e-01 0.2394710
## [105,] 7.038752e-01 0.2961248
## [106,] 5.972235e-01 0.4027765
## [107,] 7.129598e-01 0.2870402
## [108,] 7.605290e-01 0.2394710
## [109,] 7.560688e-01 0.2439312
## [110,] 7.644949e-01 0.2355051
## [111,] 4.276550e-01 0.5723450
## [112,] 1.041752e-01 0.8958248
## [113,] 1.506656e-02 0.9849334
## [114,] 2.307714e-04 0.9997692
## [115,] 2.307714e-04 0.9997692
## [116,] 2.169631e-02 0.9783037
## [117,] 3.638410e-02 0.9636159
## [118,] 1.902756e-01 0.8097244
## [119,] 6.830558e-01 0.3169442
## [120,] 6.140977e-01 0.3859023
## [121,] 6.830558e-01 0.3169442
## [122,] 6.830558e-01 0.3169442
## [123,] 6.712545e-01 0.3287455
## [124,] 6.299251e-01 0.3700749
## [125,] 5.972235e-01 0.4027765
## [126,] 5.403917e-01 0.4596083
## [127,] 4.516301e-01 0.5483699
## [128,] 3.784562e-01 0.6215438
## [129,] 3.040388e-01 0.6959612
## [130,] 9.092726e-02 0.9090727
## [131,] 1.704783e-01 0.8295217
## [132,] 2.797937e-01 0.7202063
## [133,] 5.972235e-01 0.4027765
## [134,] 7.286459e-01 0.2713541
## [135,] 7.038752e-01 0.2961248
## [136,] 7.286459e-01 0.2713541
## [137,] 6.584833e-01 0.3415167
## [138,] 6.447146e-01 0.3552854
## [139,] 4.276550e-01 0.5723450
## [140,] 2.112288e-01 0.7887712
## [141,] 2.332262e-01 0.7667738
## [142,] 6.825820e-02 0.9317418
## [143,] 1.790040e-04 0.9998210
## [144,] 1.056111e-07 0.9999999
## [145,] 6.606404e-10 1.0000000
## [146,] 5.324369e-08 0.9999999
## [147,] 1.430687e-06 0.9999986
## [148,] 7.814981e-04 0.9992185
## [149,] 7.212058e-01 0.2787942
## [150,] 7.547868e-01 0.2452132
## [151,] 7.286459e-01 0.2713541
## [152,] 7.644949e-01 0.2355051
## [153,] 7.644949e-01 0.2355051
## [154,] 7.129598e-01 0.2870402
## [155,] 7.353117e-01 0.2646883
## [156,] 7.646084e-01 0.2353916
## [157,] 7.482228e-01 0.2517772
## [158,] 6.939185e-01 0.3060815
## [159,] 1.506656e-02 0.9849334
## [160,] 1.243321e-03 0.9987567
## [161,] 2.079981e-05 0.9999792
## [162,] 1.174526e-05 0.9999883
## [163,] 6.544421e-06 0.9999935
## [164,] 2.079981e-05 0.9999792
## [165,] 1.560275e-03 0.9984397
## [166,] 1.519232e-01 0.8480768
## [167,] 5.603504e-01 0.4396496
## [168,] 6.447146e-01 0.3552854
## [169,] 7.038752e-01 0.2961248
## [170,] 7.560688e-01 0.2439312
## [171,] 7.432842e-01 0.2567158
## [172,] 7.482228e-01 0.2517772
## [173,] 7.412327e-01 0.2587673
## [174,] 2.797937e-01 0.7202063
## [175,] 1.041752e-01 0.8958248
## [176,] 9.092726e-02 0.9090727
## [177,] 3.638410e-02 0.9636159
## [178,] 5.669323e-03 0.9943307
## [179,] 1.030412e-02 0.9896959
## [180,] 4.612394e-03 0.9953876
## [181,] 7.897220e-02 0.9210278
## [182,] 7.464361e-01 0.2535639
## [183,] 7.646084e-01 0.2353916
## [184,] 6.939185e-01 0.3060815
## [185,] 1.346697e-01 0.8653303
## [186,] 1.902756e-01 0.8097244
## [187,] 2.797937e-01 0.7202063
## [188,] 2.332262e-01 0.7667738
## [189,] 3.535550e-01 0.6464450
## [190,] 9.092726e-02 0.9090727
## [191,] 2.307714e-04 0.9997692
## [192,] 8.188225e-05 0.9999181
## [193,] 2.307714e-04 0.9997692
## [194,] 4.860744e-06 0.9999951
## [195,] 1.383854e-04 0.9998616
## [196,] 6.299251e-01 0.3700749
## [197,] 7.353117e-01 0.2646883
## [198,] 6.447146e-01 0.3552854
## [199,] 7.644949e-01 0.2355051
## [200,] 5.793033e-01 0.4206967
## [201,] 6.584833e-01 0.3415167
## [202,] 6.447146e-01 0.3552854
## [203,] 6.299251e-01 0.3700749
## [204,] 4.032123e-01 0.5967877
## [205,] 6.825820e-02 0.9317418
## [206,] 3.638410e-02 0.9636159
## [207,] 3.638410e-02 0.9636159
## [208,] 1.506656e-02 0.9849334
## [209,] 1.383854e-04 0.9998616
## [210,] 3.040388e-01 0.6959612
## [211,] 5.793033e-01 0.4206967
## [212,] 1.902756e-01 0.8097244
## [213,] 2.112288e-01 0.7887712
## [214,] 4.516301e-01 0.5483699
## [215,] 6.584833e-01 0.3415167
## [216,] 7.637801e-01 0.2362199
## [217,] 7.641214e-01 0.2358786
## [218,] 7.482228e-01 0.2517772
## [219,] 7.524773e-01 0.2475227
## [220,] 7.630313e-01 0.2369687
## [221,] 7.613322e-01 0.2386678
## [222,] 6.140977e-01 0.3859023
## [223,] 7.509468e-01 0.2490532
## [224,] 7.286459e-01 0.2713541
## [225,] 7.464361e-01 0.2535639
## [226,] 7.547868e-01 0.2452132
## [227,] 7.630313e-01 0.2369687
## [228,] 2.112288e-01 0.7887712
## [229,] 3.784562e-01 0.6215438
## [230,] 6.712545e-01 0.3287455
## [231,] 7.212058e-01 0.2787942
## [232,] 6.584833e-01 0.3415167
## [233,] 4.516301e-01 0.5483699
## [234,] 6.299251e-01 0.3700749
## [235,] 4.032123e-01 0.5967877
## [236,] 7.241136e-01 0.2758864
## [237,] 7.646084e-01 0.2353916
## [238,] 7.129598e-01 0.2870402
## [239,] 7.579755e-01 0.2420245
## [240,] 5.194702e-01 0.4805298
## [241,] 7.605290e-01 0.2394710
## [242,] 5.793033e-01 0.4206967
## [243,] 7.038752e-01 0.2961248
## [244,] 7.630313e-01 0.2369687
## [245,] 2.112288e-01 0.7887712
## [246,] 4.976465e-01 0.5023535
## [247,] 1.030412e-02 0.9896959
## [248,] 2.797937e-01 0.7202063
## [249,] 1.187510e-01 0.8812490
## [250,] 2.797937e-01 0.7202063
## [251,] 7.464361e-01 0.2535639
## [252,] 4.976465e-01 0.5023535
## [253,] 9.092726e-02 0.9090727
## [254,] 1.056111e-07 0.9999999
## [255,] 2.169631e-02 0.9783037
## [256,] 3.286877e-01 0.6713123
## [257,] 5.603504e-01 0.4396496
## [258,] 6.830558e-01 0.3169442
## [259,] 6.299251e-01 0.3700749
## [260,] 7.605290e-01 0.2394710
## [261,] 7.038752e-01 0.2961248
## [262,] 7.630313e-01 0.2369687
## [263,] 7.524773e-01 0.2475227
## [264,] 7.129598e-01 0.2870402
## [265,] 7.312572e-01 0.2687428
## [266,] 7.286459e-01 0.2713541
## [267,] 7.482228e-01 0.2517772
## [268,] 7.412327e-01 0.2587673
## [269,] 4.750001e-01 0.5249999
## [270,] 7.212058e-01 0.2787942
## [271,] 6.939185e-01 0.3060815
## [272,] 7.038752e-01 0.2961248
## [273,] 2.332262e-01 0.7667738
## [274,] 9.092726e-02 0.9090727
## [275,] 7.312572e-01 0.2687428
## [276,] 4.750001e-01 0.5249999
## [277,] 7.524773e-01 0.2475227
## [278,] 7.509468e-01 0.2490532
## [279,] 7.376378e-01 0.2623622
## [280,] 7.630313e-01 0.2369687
## [281,] 9.092726e-02 0.9090727
## [282,] 7.353117e-01 0.2646883
## [283,] 4.750001e-01 0.5249999
## [284,] 7.161763e-01 0.2838237
## [285,] 7.605290e-01 0.2394710
## [286,] 5.793033e-01 0.4206967
## [287,] 6.634309e-01 0.3365691
## [288,] 9.873944e-04 0.9990126
## [289,] 7.646084e-01 0.2353916
## [290,] 6.447146e-01 0.3552854
## [291,] 7.560688e-01 0.2439312
## [292,] 7.613322e-01 0.2386678
## [293,] 6.447146e-01 0.3552854
## [294,] 6.872741e-01 0.3127259
## [295,] 7.286459e-01 0.2713541
## [296,] 6.977901e-01 0.3022099
## [297,] 5.480585e-01 0.4519415
## [298,] 7.161763e-01 0.2838237
## [299,] 7.241136e-01 0.2758864
## [300,] 3.286877e-01 0.6713123
## [301,] 6.037307e-01 0.3962693
## [302,] 5.793033e-01 0.4206967
## [303,] 7.590154e-01 0.2409846
## [304,] 7.241136e-01 0.2758864
## [305,] 6.712545e-01 0.3287455
## [306,] 7.482228e-01 0.2517772
## [307,] 1.187510e-01 0.8812490
## [308,] 6.584833e-01 0.3415167
## [309,] 1.811525e-02 0.9818847
## [310,] 4.750001e-01 0.5249999
## [311,] 7.216952e-02 0.9278305
## [312,] 6.712545e-01 0.3287455
## [313,] 8.334603e-02 0.9166540
## [314,] 5.972235e-01 0.4027765
## [315,] 7.624605e-01 0.2375395
## [316,] 7.376378e-01 0.2623622
## [317,] 6.712545e-01 0.3287455
## [318,] 6.037307e-01 0.3962693
## [319,] 3.040388e-01 0.6959612
## [320,] 1.902756e-01 0.8097244
## [321,] 5.028333e-02 0.9497167
## [322,] 1.045043e-06 0.9999990
## [323,] 4.032123e-01 0.5967877
## [324,] 3.075102e-02 0.9692490
## [325,] 7.432842e-01 0.2567158
## [326,] 5.793033e-01 0.4206967
## [327,] 2.797937e-01 0.7202063
## [328,] 7.547868e-01 0.2452132
## [329,] 5.669323e-03 0.9943307
## [330,] 4.125051e-01 0.5874949
## [331,] 5.403917e-01 0.4596083
## [332,] 5.480585e-01 0.4519415
## [333,] 7.376378e-01 0.2623622
## [334,] 9.092726e-02 0.9090727
## [335,] 7.613322e-01 0.2386678
## [336,] 2.588235e-02 0.9741176
## [337,] 7.464361e-01 0.2535639
## [338,] 5.028333e-02 0.9497167
## [339,] 2.332262e-01 0.7667738
## [340,] 7.482228e-01 0.2517772
## [341,] 3.075102e-02 0.9692490
## [342,] 6.037307e-01 0.3962693
## [343,] 7.637801e-01 0.2362199
## [344,] 6.037307e-01 0.3962693
## [345,] 7.482228e-01 0.2517772
## [346,] 6.140977e-01 0.3859023
## [347,] 1.778262e-01 0.8221738
## [348,] 7.560688e-01 0.2439312
## [349,] 1.095322e-01 0.8904678
## [350,] 7.644949e-01 0.2355051
## [351,] 4.976465e-01 0.5023535
## [352,] 7.613322e-01 0.2386678
## [353,] 1.346697e-01 0.8653303
## [354,] 7.590154e-01 0.2409846
## [355,] 2.169631e-02 0.9783037
## [356,] 5.862054e-01 0.4137946
## [357,] 7.630313e-01 0.2369687
## [358,] 6.830558e-01 0.3169442
## [359,] 7.241136e-01 0.2758864
## [360,] 7.637801e-01 0.2362199
## [361,] 7.579755e-01 0.2420245
## [362,] 3.286877e-01 0.6713123
## [363,] 7.641214e-01 0.2358786
## [364,] 7.579755e-01 0.2420245
## [365,] 5.603504e-01 0.4396496
## [366,] 7.353117e-01 0.2646883
## [367,] 3.535550e-01 0.6464450
## [368,] 7.637801e-01 0.2362199
## [369,] 7.509468e-01 0.2490532
## [370,] 7.579755e-01 0.2420245
## [371,] 6.584833e-01 0.3415167
## [372,] 7.353117e-01 0.2646883
## [373,] 6.830558e-01 0.3169442
## [374,] 6.712545e-01 0.3287455
## [375,] 7.129598e-01 0.2870402
## [376,] 5.676408e-01 0.4323592
## [377,] 7.646084e-01 0.2353916
## [378,] 4.032123e-01 0.5967877
## [379,] 3.075102e-02 0.9692490
## [380,] 1.951365e-03 0.9980486
## [381,] 1.041752e-01 0.8958248
## [382,] 4.612394e-03 0.9953876
## [383,] 1.479987e-07 0.9999999
## [384,] 6.825820e-02 0.9317418
## [385,] 1.243321e-03 0.9987567
## [386,] 1.187510e-01 0.8812490
## [387,] 7.897220e-02 0.9210278
## [388,] 1.056111e-07 0.9999999
## [389,] 4.361166e-09 1.0000000
## [390,] 4.286626e-02 0.9571337
## [391,] 7.605290e-01 0.2394710
## [392,] 7.641214e-01 0.2358786
## [393,] 7.605290e-01 0.2394710
## [394,] 9.092726e-02 0.9090727
## [395,] 1.951365e-03 0.9980486
## [396,] 6.140977e-01 0.3859023
## [397,] 7.605290e-01 0.2394710
## [398,] 7.630313e-01 0.2369687
## [399,] 7.038752e-01 0.2961248
## [400,] 7.547868e-01 0.2452132
## [401,] 7.509468e-01 0.2490532
## [402,] 4.612394e-03 0.9953876
## [403,] 2.797937e-01 0.7202063
## [404,] 7.524773e-01 0.2475227
## [405,] 7.579755e-01 0.2420245
## [406,] 7.579755e-01 0.2420245
## [407,] 2.561327e-01 0.7438673
## [408,] 5.793033e-01 0.4206967
## [409,] 7.605290e-01 0.2394710
## [410,] 6.758316e-01 0.3241684
## [411,] 7.641214e-01 0.2358786
## [412,] 7.464361e-01 0.2535639
## [413,] 7.644949e-01 0.2355051
## [414,] 2.112288e-01 0.7887712
## [415,] 4.976465e-01 0.5023535
## [416,] 7.624605e-01 0.2375395
## [417,] 7.509468e-01 0.2490532
## [418,] 7.624605e-01 0.2375395
## [419,] 4.750001e-01 0.5249999
## [420,] 7.353117e-01 0.2646883
## [421,] 7.129598e-01 0.2870402
## [422,] 4.780646e-05 0.9999522
## [423,] 7.432842e-01 0.2567158
## [424,] 6.140977e-01 0.3859023
## [425,] 6.037307e-01 0.3962693
## [426,] 7.129598e-01 0.2870402
## [427,] 7.212058e-01 0.2787942
## [428,] 7.524773e-01 0.2475227
## [429,] 2.588235e-02 0.9741176
## [430,] 7.464361e-01 0.2535639
## [431,] 1.506656e-02 0.9849334
## [432,] 7.286459e-01 0.2713541
## [433,] 1.346697e-01 0.8653303
## [434,] 8.188225e-05 0.9999181
## [435,] 2.307714e-04 0.9997692
## [436,] 1.243321e-03 0.9987567
## [437,] 7.312572e-01 0.2687428
## [438,] 6.712545e-01 0.3287455
## [439,] 7.605290e-01 0.2394710
## [440,] 5.403917e-01 0.4596083
## [441,] 2.754129e-05 0.9999725
## [442,] 7.590154e-01 0.2409846
## [443,] 1.902756e-01 0.8097244
## [444,] 5.480585e-01 0.4519415
## [445,] 5.676408e-01 0.4323592
## [446,] 9.092726e-02 0.9090727
## [447,] 1.902756e-01 0.8097244
## [448,] 3.075102e-02 0.9692490
## [449,] 4.276550e-01 0.5723450
## [450,] 3.797136e-04 0.9996203
## [451,] 1.383854e-04 0.9998616
## [452,] 6.299251e-01 0.3700749
## [453,] 1.519232e-01 0.8480768
## [454,] 6.634309e-01 0.3365691
## [455,] 6.830558e-01 0.3169442
## [456,] 7.161763e-01 0.2838237
## [457,] 7.613322e-01 0.2386678
## [458,] 6.447146e-01 0.3552854
## [459,] 6.202084e-01 0.3797916
## [460,] 7.613322e-01 0.2386678
## [461,] 7.524773e-01 0.2475227
## [462,] 6.712545e-01 0.3287455
## [463,] 5.194702e-01 0.4805298
## [464,] 7.630313e-01 0.2369687
## [465,] 1.041752e-01 0.8958248
## [466,] 7.641214e-01 0.2358786
## [467,] 2.561327e-01 0.7438673
## [468,] 7.038752e-01 0.2961248
## [469,] 7.547868e-01 0.2452132
## [470,] 1.811525e-02 0.9818847
## [471,] 3.380800e-01 0.6619200
## [472,] 7.641214e-01 0.2358786
## [473,] 3.133266e-01 0.6866734
## [474,] 6.977901e-01 0.3022099
## [475,] 7.464361e-01 0.2535639
## [476,] 5.862054e-01 0.4137946
## [477,] 2.169631e-02 0.9783037
## [478,] 6.447146e-01 0.3552854
## [479,] 5.028333e-02 0.9497167
## [480,] 9.873944e-04 0.9990126
## [481,] 4.612394e-03 0.9953876
## [482,] 6.164518e-04 0.9993835
## [483,] 4.286626e-02 0.9571337
## [484,] 1.951365e-03 0.9980486
## [485,] 5.194702e-01 0.4805298
## [486,] 7.560688e-01 0.2439312
## [487,] 7.644949e-01 0.2355051
## [488,] 7.161763e-01 0.2838237
## [489,] 1.704783e-01 0.8295217
## [490,] 5.793033e-01 0.4206967
## [491,] 1.041752e-01 0.8958248
## [492,] 3.739321e-03 0.9962607
## [493,] 6.830558e-01 0.3169442
## [494,] 3.784562e-01 0.6215438
## [495,] 4.032123e-01 0.5967877
## [496,] 3.075102e-02 0.9692490
## [497,] 2.432140e-03 0.9975679
## [498,] 4.032123e-01 0.5967877
## [499,] 6.830558e-01 0.3169442
## [500,] 6.872741e-01 0.3127259
## [501,] 7.630313e-01 0.2369687
## [502,] 7.624605e-01 0.2375395
## [503,] 6.977901e-01 0.3022099
## [504,] 7.605290e-01 0.2394710
## [505,] 7.241136e-01 0.2758864
## [506,] 7.624605e-01 0.2375395
## [507,] 6.500426e-01 0.3499574
## [508,] 7.641214e-01 0.2358786
## [509,] 6.447146e-01 0.3552854
## [510,] 7.613322e-01 0.2386678
## [511,] 7.613322e-01 0.2386678
## [512,] 7.129598e-01 0.2870402
##
## $all.loglik
## [1] -611.3902 342.6443 350.2222 351.5459 351.9658 352.1204 352.1820
## [8] 352.2078 352.2191 352.2243 352.2270 352.2285 352.2295 352.2303
## [15] 352.2310 352.2317 352.2323 352.2329 352.2335 352.2340 352.2346
## [22] 352.2351 352.2357 352.2362 352.2367 352.2373 352.2378 352.2382
## [29] 352.2387 352.2392 352.2397 352.2401 352.2406 352.2411 352.2415
## [36] 352.2419 352.2424 352.2428 352.2432 352.2436 352.2440 352.2444
## [43] 352.2448 352.2452 352.2455 352.2459 352.2463 352.2466 352.2470
## [50] 352.2473 352.2477 352.2480 352.2483 352.2487 352.2490 352.2493
## [57] 352.2496 352.2499 352.2502 352.2505 352.2508 352.2511 352.2514
## [64] 352.2517 352.2520 352.2522 352.2525 352.2528 352.2531 352.2533
## [71] 352.2536 352.2538 352.2541 352.2543 352.2546 352.2548 352.2551
## [78] 352.2553 352.2555 352.2557 352.2560 352.2562 352.2564 352.2566
## [85] 352.2569 352.2571 352.2573 352.2575 352.2577 352.2579 352.2581
## [92] 352.2583 352.2585 352.2587 352.2589 352.2591 352.2593 352.2595
## [99] 352.2596 352.2598 352.2600 352.2602 352.2604 352.2605 352.2607
## [106] 352.2609 352.2610 352.2612 352.2614 352.2615 352.2617 352.2619
## [113] 352.2620 352.2622 352.2623 352.2625 352.2626 352.2628 352.2629
## [120] 352.2631 352.2632 352.2634 352.2635 352.2637 352.2638 352.2640
## [127] 352.2641 352.2642 352.2644 352.2645 352.2647 352.2648 352.2649
## [134] 352.2651 352.2652 352.2653 352.2654 352.2656 352.2657 352.2658
## [141] 352.2660 352.2661 352.2662 352.2663 352.2664 352.2666 352.2667
## [148] 352.2668 352.2669 352.2670 352.2672 352.2673 352.2674 352.2675
## [155] 352.2676 352.2677 352.2678 352.2680 352.2681 352.2682 352.2683
## [162] 352.2684 352.2685 352.2686 352.2687 352.2688 352.2689 352.2690
## [169] 352.2691 352.2692 352.2694 352.2695 352.2696 352.2697 352.2698
## [176] 352.2699 352.2700 352.2701 352.2702 352.2703 352.2704 352.2705
## [183] 352.2706 352.2707 352.2708 352.2709 352.2710 352.2711 352.2711
## [190] 352.2712 352.2713 352.2714 352.2715 352.2716 352.2717 352.2718
## [197] 352.2719 352.2720 352.2721 352.2722 352.2723 352.2724 352.2725
## [204] 352.2726 352.2726 352.2727 352.2728 352.2729 352.2730 352.2731
## [211] 352.2732 352.2733 352.2734 352.2735 352.2736 352.2736 352.2737
## [218] 352.2738 352.2739 352.2740 352.2741 352.2742 352.2743 352.2744
## [225] 352.2744 352.2745 352.2746 352.2747 352.2748 352.2749 352.2750
## [232] 352.2751 352.2752 352.2752 352.2753 352.2754 352.2755 352.2756
## [239] 352.2757 352.2758 352.2759 352.2760 352.2760 352.2761 352.2762
## [246] 352.2763 352.2764 352.2765 352.2766 352.2767 352.2768 352.2769
## [253] 352.2769 352.2770 352.2771 352.2772 352.2773 352.2774 352.2775
## [260] 352.2776 352.2777 352.2778 352.2779 352.2780 352.2781 352.2781
## [267] 352.2782 352.2783 352.2784 352.2785 352.2786 352.2787 352.2788
## [274] 352.2789 352.2790 352.2791 352.2792 352.2793 352.2794 352.2795
## [281] 352.2796 352.2797 352.2798 352.2799 352.2800 352.2801 352.2802
## [288] 352.2803 352.2804 352.2805 352.2806 352.2807 352.2808 352.2809
## [295] 352.2810 352.2811 352.2812 352.2814 352.2815 352.2816 352.2817
## [302] 352.2818 352.2819 352.2820 352.2821 352.2822 352.2824 352.2825
## [309] 352.2826 352.2827 352.2828 352.2829 352.2831 352.2832 352.2833
## [316] 352.2834 352.2836 352.2837 352.2838 352.2839 352.2841 352.2842
## [323] 352.2843 352.2845 352.2846 352.2847 352.2849 352.2850 352.2851
## [330] 352.2853 352.2854 352.2856 352.2857 352.2859 352.2860 352.2862
## [337] 352.2863 352.2865 352.2866 352.2868 352.2869 352.2871 352.2873
## [344] 352.2874 352.2876 352.2878 352.2879 352.2881 352.2883 352.2884
## [351] 352.2886 352.2888 352.2890 352.2892 352.2894 352.2896 352.2897
## [358] 352.2899 352.2901 352.2903 352.2905 352.2908 352.2910 352.2912
## [365] 352.2914 352.2916 352.2918 352.2921 352.2923 352.2925 352.2928
## [372] 352.2930 352.2933 352.2935 352.2938 352.2940 352.2943 352.2946
## [379] 352.2948 352.2951 352.2954 352.2957 352.2960 352.2963 352.2966
## [386] 352.2969 352.2972 352.2975 352.2979 352.2982 352.2985 352.2989
## [393] 352.2992 352.2996 352.3000 352.3004 352.3007 352.3011 352.3015
## [400] 352.3020 352.3024 352.3028 352.3032 352.3037 352.3042 352.3046
## [407] 352.3051 352.3056 352.3061 352.3066 352.3072 352.3077 352.3083
## [414] 352.3088 352.3094 352.3100 352.3107 352.3113 352.3119 352.3126
## [421] 352.3133 352.3140 352.3147 352.3155 352.3163 352.3170 352.3179
## [428] 352.3187 352.3196 352.3204 352.3214 352.3223 352.3233 352.3243
## [435] 352.3253 352.3264 352.3275 352.3286 352.3298 352.3310 352.3322
## [442] 352.3335 352.3348 352.3362 352.3376 352.3391 352.3406 352.3422
## [449] 352.3438 352.3455 352.3473 352.3491 352.3510 352.3529 352.3549
## [456] 352.3570 352.3592 352.3614 352.3637 352.3661 352.3687 352.3713
## [463] 352.3739 352.3767 352.3796 352.3827 352.3858 352.3890 352.3924
## [470] 352.3959 352.3995 352.4033 352.4072 352.4112 352.4154 352.4197
## [477] 352.4242 352.4289 352.4337 352.4386 352.4438 352.4491 352.4546
## [484] 352.4602 352.4661 352.4721 352.4783 352.4846 352.4911 352.4978
## [491] 352.5046 352.5116 352.5188 352.5261 352.5335 352.5410 352.5487
## [498] 352.5565 352.5643 352.5723 352.5803 352.5883 352.5964 352.6045
## [505] 352.6126 352.6207 352.6288 352.6368 352.6448 352.6527 352.6605
## [512] 352.6681 352.6757 352.6831 352.6904 352.6976 352.7045 352.7113
## [519] 352.7179 352.7243 352.7306 352.7366 352.7424 352.7480 352.7534
## [526] 352.7586 352.7635 352.7683 352.7728 352.7772 352.7813 352.7852
## [533] 352.7890 352.7926 352.7959 352.7991 352.8021 352.8050 352.8077
## [540] 352.8102 352.8126 352.8148 352.8169 352.8189 352.8208 352.8225
## [547] 352.8241 352.8257 352.8271 352.8284 352.8296 352.8308 352.8319
## [554] 352.8329 352.8338 352.8347 352.8355 352.8362 352.8369 352.8375
## [561] 352.8381 352.8387 352.8392 352.8397 352.8401 352.8405 352.8409
## [568] 352.8412 352.8415 352.8418 352.8421 352.8423 352.8426 352.8428
## [575] 352.8430 352.8432 352.8433 352.8435 352.8436 352.8437 352.8439
## [582] 352.8440 352.8441 352.8442 352.8442 352.8443 352.8444 352.8445
## [589] 352.8445 352.8446 352.8446 352.8447 352.8447 352.8448 352.8448
## [596] 352.8448 352.8449 352.8449 352.8449 352.8449 352.8450 352.8450
## [603] 352.8450 352.8450 352.8450 352.8450 352.8451 352.8451 352.8451
## [610] 352.8451 352.8451 352.8451 352.8451 352.8451 352.8451 352.8451
## [617] 352.8451 352.8451 352.8452 352.8452 352.8452 352.8452 352.8452
## [624] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [631] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [638] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [645] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [652] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [659] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [666] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [673] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [680] 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452 352.8452
## [687] 352.8452 352.8452 352.8452
##
## $restarts
## [1] 0
##
## $ft
## [1] "normalmixEM"
##
## attr(,"class")
## [1] "mixEM"
# Extract mean and variance for each mode
mean_mode1 <- fit_result$mu[1]
print(mean_mode1)
## [1] 0.3411267
variance_mode1 <- fit_result$sigma[1]^2
mean_mode2 <- fit_result$mu[2]
print(mean_mode2)
## [1] 0.4779809
variance_mode2 <- fit_result$sigma[2]^2
# Outlier detection
# Calculate lower and upper bounds for 0.001 probability limits
lower_limit <- qnorm(0.001, mean_mode1, sqrt(variance_mode1))
print(lower_limit)
## [1] 0.1533233
upper_limit <- qnorm(0.999, mean_mode2, sqrt(variance_mode2))
print(upper_limit)
## [1] 0.8988497
for(i in 1:512){
for(j in 1:length(img[i,])){
# Paint black outliers
if(part2_img[i,j] > upper_limit | part2_img[i,j] < lower_limit){
part2_img[i,j] = 0
}
}
}
par(mfrow = c(1,2))
plot(NA,xlim=c(0,nrow(img)),ylim=c(0,ncol(img)),xlab="Horizontal",ylab="Vertical")
rasterImage(img,0,0,nrow(img),ncol(img))
plot(NA,xlim=c(0,nrow(part2_img)),ylim=c(0,ncol(part2_img)),xlab="Horizontal",ylab="Vertical")
rasterImage(part2_img,0,0,nrow(part2_img),ncol(part2_img))
Clearly, assumption that the row’s distribution is same didn’t hold.
# Part 2.2
# Assuming all the columns have the same distribution of pixels
column1 = img[,1]
column_img = img
# Display the distribution of the column
hist(column1, main = "Pixel Value Histogram", xlab = "Pixel Value", ylab = "Frequency", col = "lightblue", border = "black")
# Fit the pixel values to a bimodal distribution
fit_result <- normalmixEM(column1, k = 2) # 'k' specifies the number of components in the mixture model
## number of iterations= 81
fit_result
## $x
## [1] 0.7490196 0.7882353 0.8117647 0.8078431 0.8196078 0.8156863 0.7019608
## [8] 0.5372549 0.4470588 0.3529412 0.3176471 0.3450980 0.3647059 0.3921569
## [15] 0.4431373 0.4745098 0.3725490 0.3921569 0.4431373 0.3764706 0.3647059
## [22] 0.4274510 0.6392157 0.7450980 0.8352941 0.8392157 0.7960784 0.7960784
## [29] 0.7254902 0.5450980 0.4313725 0.3843137 0.3647059 0.4235294 0.3960784
## [36] 0.3921569 0.4745098 0.4039216 0.4196078 0.3960784 0.4313725 0.4941176
## [43] 0.4549020 0.3803922 0.5176471 0.7215686 0.7725490 0.7803922 0.7725490
## [50] 0.8352941 0.8117647 0.7176471 0.5647059 0.4156863 0.3647059 0.3490196
## [57] 0.4235294 0.4823529 0.4235294 0.4235294 0.4901961 0.4745098 0.4509804
## [64] 0.4549020 0.3960784 0.3882353 0.3490196 0.4549020 0.5921569 0.6823529
## [71] 0.7764706 0.7529412 0.7921569 0.7647059 0.6235294 0.5490196 0.4588235
## [78] 0.3490196 0.3803922 0.4196078 0.4000000 0.4078431 0.4509804 0.4549020
## [85] 0.4705882 0.5137255 0.4980392 0.4784314 0.3882353 0.4117647 0.4666667
## [92] 0.6941176 0.7921569 0.7647059 0.8039216 0.7058824 0.7372549 0.6235294
## [99] 0.4941176 0.3882353 0.3843137 0.3960784 0.3607843 0.3960784 0.4470588
## [106] 0.4431373 0.4627451 0.4745098 0.5058824 0.4392157 0.4509804 0.3921569
## [113] 0.3607843 0.5490196 0.6823529 0.7098039 0.7215686 0.7098039 0.7058824
## [120] 0.7372549 0.6352941 0.4431373 0.3607843 0.4117647 0.3725490 0.3843137
## [127] 0.5058824 0.5137255 0.4901961 0.5098039 0.4941176 0.5058824 0.5372549
## [134] 0.4901961 0.4745098 0.5490196 0.6901961 0.7803922 0.7411765 0.7019608
## [141] 0.6941176 0.7607843 0.6745098 0.5921569 0.4274510 0.3803922 0.3058824
## [148] 0.3647059 0.4274510 0.4745098 0.5294118 0.4509804 0.4980392 0.4901961
## [155] 0.5254902 0.5294118 0.4431373 0.4117647 0.5411765 0.7137255 0.7647059
## [162] 0.7450980 0.7372549 0.7490196 0.7647059 0.7411765 0.6235294 0.4862745
## [169] 0.4000000 0.3450980 0.4039216 0.3921569 0.3921569 0.4784314 0.4980392
## [176] 0.5137255 0.5333333 0.4941176 0.5254902 0.4313725 0.3882353 0.4745098
## [183] 0.6666667 0.6666667 0.7254902 0.7215686 0.7254902 0.6980392 0.6823529
## [190] 0.5764706 0.4000000 0.3568627 0.3882353 0.4666667 0.4039216 0.4705882
## [197] 0.5764706 0.4666667 0.5137255 0.4549020 0.4823529 0.4235294 0.4313725
## [204] 0.3803922 0.4823529 0.6470588 0.6156863 0.6313725 0.6431373 0.6941176
## [211] 0.5960784 0.4196078 0.4039216 0.4156863 0.3411765 0.3490196 0.3882353
## [218] 0.4313725 0.4666667 0.5137255 0.5254902 0.6000000 0.5372549 0.5098039
## [225] 0.4156863 0.4392157 0.3803922 0.4039216 0.5176471 0.6039216 0.6549020
## [232] 0.6392157 0.6431373 0.5843137 0.5294118 0.4784314 0.4627451 0.4039216
## [239] 0.3411765 0.4000000 0.4588235 0.5607843 0.6196078 0.6392157 0.6156863
## [246] 0.5921569 0.5725490 0.4862745 0.4235294 0.3647059 0.3843137 0.5254902
## [253] 0.6039216 0.6235294 0.6549020 0.6117647 0.5450980 0.5372549 0.5411765
## [260] 0.4666667 0.4156863 0.4431373 0.5137255 0.6156863 0.6784314 0.6470588
## [267] 0.6196078 0.5960784 0.6313725 0.5960784 0.4588235 0.4274510 0.3647059
## [274] 0.3882353 0.5137255 0.5607843 0.5686275 0.5725490 0.5215686 0.5647059
## [281] 0.5450980 0.4431373 0.4352941 0.3529412 0.4470588 0.4549020 0.4549020
## [288] 0.6235294 0.6235294 0.7215686 0.6901961 0.6352941 0.5411765 0.4392157
## [295] 0.4274510 0.3803922 0.4352941 0.4823529 0.5019608 0.5254902 0.5058824
## [302] 0.4862745 0.4980392 0.4549020 0.4196078 0.4588235 0.3254902 0.3529412
## [309] 0.4705882 0.6666667 0.7529412 0.7294118 0.7764706 0.7450980 0.6823529
## [316] 0.6196078 0.4196078 0.3607843 0.3803922 0.4588235 0.5215686 0.4627451
## [323] 0.4235294 0.4784314 0.5137255 0.5294118 0.5176471 0.4117647 0.3882353
## [330] 0.4470588 0.4627451 0.6039216 0.6823529 0.7686275 0.7686275 0.7333333
## [337] 0.7058824 0.7019608 0.5568627 0.4313725 0.3921569 0.3647059 0.3882353
## [344] 0.4313725 0.5058824 0.5098039 0.4509804 0.4784314 0.4823529 0.4392157
## [351] 0.4470588 0.3882353 0.3529412 0.4235294 0.5764706 0.6470588 0.7450980
## [358] 0.7803922 0.7882353 0.6901961 0.6901961 0.6274510 0.4745098 0.3764706
## [365] 0.3960784 0.4078431 0.4117647 0.4705882 0.5254902 0.4470588 0.4039216
## [372] 0.4156863 0.3921569 0.4431373 0.4784314 0.3490196 0.4431373 0.6823529
## [379] 0.6666667 0.7803922 0.7529412 0.7254902 0.7960784 0.7058824 0.6117647
## [386] 0.4666667 0.3607843 0.3960784 0.3960784 0.4588235 0.5607843 0.4588235
## [393] 0.4392157 0.4235294 0.4039216 0.4274510 0.4470588 0.3764706 0.3294118
## [400] 0.3725490 0.4980392 0.7176471 0.7450980 0.7686275 0.8078431 0.8235294
## [407] 0.8470588 0.7215686 0.5372549 0.3294118 0.3411765 0.3686275 0.4196078
## [414] 0.5176471 0.4627451 0.4313725 0.4078431 0.4196078 0.4196078 0.4039216
## [421] 0.4156863 0.3647059 0.3294118 0.4549020 0.6588235 0.8196078 0.7882353
## [428] 0.8000000 0.8313725 0.7686275 0.6470588 0.4039216 0.3529412 0.4509804
## [435] 0.4156863 0.3764706 0.4039216 0.4000000 0.4196078 0.4588235 0.4901961
## [442] 0.4274510 0.3960784 0.4156863 0.4431373 0.5215686 0.6627451 0.7803922
## [449] 0.8235294 0.8274510 0.8000000 0.7843137 0.7529412 0.6196078 0.4431373
## [456] 0.3450980 0.3647059 0.3960784 0.3725490 0.4039216 0.4313725 0.4000000
## [463] 0.3921569 0.3882353 0.3882353 0.3725490 0.3882353 0.4000000 0.4078431
## [470] 0.5176471 0.6980392 0.8196078 0.7960784 0.8274510 0.7882353 0.7058824
## [477] 0.5686275 0.4470588 0.4274510 0.4156863 0.3607843 0.3450980 0.3882353
## [484] 0.4549020 0.3647059 0.4117647 0.4313725 0.3921569 0.3960784 0.4196078
## [491] 0.4117647 0.3921569 0.4431373 0.6549020 0.8352941 0.8078431 0.7843137
## [498] 0.7803922 0.7725490 0.5411765 0.3960784 0.3568627 0.4000000 0.3960784
## [505] 0.3411765 0.3450980 0.4549020 0.4431373 0.4352941 0.3921569 0.4000000
## [512] 0.3882353
##
## $lambda
## [1] 0.6552446 0.3447554
##
## $mu
## [1] 0.4333960 0.6993034
##
## $sigma
## [1] 0.05673184 0.08565673
##
## $loglik
## [1] 382.63
##
## $posterior
## comp.1 comp.2
## [1,] 6.454926e-07 0.9999993545
## [2,] 1.573566e-08 0.9999999843
## [3,] 1.489937e-09 0.9999999985
## [4,] 2.221772e-09 0.9999999978
## [5,] 6.646757e-10 0.9999999993
## [6,] 9.964860e-10 0.9999999990
## [7,] 3.905897e-05 0.9999609410
## [8,] 7.627794e-01 0.2372205881
## [9,] 9.953267e-01 0.0046733314
## [10,] 9.997319e-01 0.0002680747
## [11,] 9.998635e-01 0.0001364777
## [12,] 9.997736e-01 0.0002264399
## [13,] 9.996477e-01 0.0003523199
## [14,] 9.992679e-01 0.0007320671
## [15,] 9.959755e-01 0.0040244821
## [16,] 9.857297e-01 0.0142702671
## [17,] 9.995716e-01 0.0004284240
## [18,] 9.992679e-01 0.0007320671
## [19,] 9.959755e-01 0.0040244821
## [20,] 9.995257e-01 0.0004743358
## [21,] 9.996477e-01 0.0003523199
## [22,] 9.977284e-01 0.0022715584
## [23,] 5.062899e-03 0.9949371006
## [24,] 9.221150e-07 0.9999990779
## [25,] 1.280901e-10 0.9999999999
## [26,] 8.430043e-11 0.9999999999
## [27,] 7.249456e-09 0.9999999928
## [28,] 7.249456e-09 0.9999999928
## [29,] 5.269627e-06 0.9999947304
## [30,] 6.761853e-01 0.3238146899
## [31,] 9.973895e-01 0.0026104569
## [32,] 9.994139e-01 0.0005861329
## [33,] 9.996477e-01 0.0003523199
## [34,] 9.980181e-01 0.0019818679
## [35,] 9.991786e-01 0.0008214260
## [36,] 9.992679e-01 0.0007320671
## [37,] 9.857297e-01 0.0142702671
## [38,] 9.989575e-01 0.0010425088
## [39,] 9.982663e-01 0.0017336932
## [40,] 9.991786e-01 0.0008214260
## [41,] 9.973895e-01 0.0026104569
## [42,] 9.661198e-01 0.0338802240
## [43,] 9.936498e-01 0.0063502097
## [44,] 9.994734e-01 0.0005265749
## [45,] 9.002717e-01 0.0997283356
## [46,] 7.407705e-06 0.9999925923
## [47,] 7.179033e-08 0.9999999282
## [48,] 3.379132e-08 0.9999999662
## [49,] 7.179033e-08 0.9999999282
## [50,] 1.280901e-10 0.9999999999
## [51,] 1.489937e-09 0.9999999985
## [52,] 1.038538e-05 0.9999896146
## [53,] 4.037536e-01 0.5962464130
## [54,] 9.984794e-01 0.0015206154
## [55,] 9.996477e-01 0.0003523199
## [56,] 9.997540e-01 0.0002460495
## [57,] 9.980181e-01 0.0019818679
## [58,] 9.799516e-01 0.0200484448
## [59,] 9.980181e-01 0.0019818679
## [60,] 9.980181e-01 0.0019818679
## [61,] 9.716059e-01 0.0283940621
## [62,] 9.857297e-01 0.0142702671
## [63,] 9.945593e-01 0.0054407162
## [64,] 9.936498e-01 0.0063502097
## [65,] 9.991786e-01 0.0008214260
## [66,] 9.993458e-01 0.0006541739
## [67,] 9.997540e-01 0.0002460495
## [68,] 9.936498e-01 0.0063502097
## [69,] 1.111444e-01 0.8888555843
## [70,] 1.925677e-04 0.9998074323
## [71,] 4.931943e-08 0.9999999507
## [72,] 4.506430e-07 0.9999995494
## [73,] 1.069492e-08 0.9999999893
## [74,] 1.508924e-07 0.9999998491
## [75,] 1.520794e-02 0.9847920649
## [76,] 6.263129e-01 0.3736871310
## [77,] 9.925696e-01 0.0074303606
## [78,] 9.997540e-01 0.0002460495
## [79,] 9.994734e-01 0.0005265749
## [80,] 9.982663e-01 0.0017336932
## [81,] 9.990758e-01 0.0009241555
## [82,] 9.988208e-01 0.0011791561
## [83,] 9.945593e-01 0.0054407162
## [84,] 9.936498e-01 0.0063502097
## [85,] 9.879207e-01 0.0120793257
## [86,] 9.167246e-01 0.0832754082
## [87,] 9.595136e-01 0.0404864062
## [88,] 9.831037e-01 0.0168963173
## [89,] 9.993458e-01 0.0006541739
## [90,] 9.986627e-01 0.0013372679
## [91,] 9.897516e-01 0.0102484466
## [92,] 7.453696e-05 0.9999254630
## [93,] 1.069492e-08 0.9999999893
## [94,] 1.508924e-07 0.9999998491
## [95,] 3.304200e-09 0.9999999967
## [96,] 2.816080e-05 0.9999718392
## [97,] 1.866715e-06 0.9999981333
## [98,] 1.520794e-02 0.9847920649
## [99,] 9.661198e-01 0.0338802240
## [100,] 9.993458e-01 0.0006541739
## [101,] 9.994139e-01 0.0005861329
## [102,] 9.991786e-01 0.0008214260
## [103,] 9.996792e-01 0.0003207845
## [104,] 9.991786e-01 0.0008214260
## [105,] 9.953267e-01 0.0046733314
## [106,] 9.959755e-01 0.0040244821
## [107,] 9.912842e-01 0.0087157776
## [108,] 9.857297e-01 0.0142702671
## [109,] 9.419923e-01 0.0580076970
## [110,] 9.965253e-01 0.0034746810
## [111,] 9.945593e-01 0.0054407162
## [112,] 9.992679e-01 0.0007320671
## [113,] 9.996792e-01 0.0003207845
## [114,] 6.263129e-01 0.3736871310
## [115,] 1.925677e-04 0.9998074323
## [116,] 2.024898e-05 0.9999797510
## [117,] 7.407705e-06 0.9999925923
## [118,] 2.024898e-05 0.9999797510
## [119,] 2.816080e-05 0.9999718392
## [120,] 1.866715e-06 0.9999981333
## [121,] 6.698270e-03 0.9933017297
## [122,] 9.959755e-01 0.0040244821
## [123,] 9.996792e-01 0.0003207845
## [124,] 9.986627e-01 0.0013372679
## [125,] 9.995716e-01 0.0004284240
## [126,] 9.994139e-01 0.0005861329
## [127,] 9.419923e-01 0.0580076970
## [128,] 9.167246e-01 0.0832754082
## [129,] 9.716059e-01 0.0283940621
## [130,] 9.304989e-01 0.0695010753
## [131,] 9.661198e-01 0.0338802240
## [132,] 9.419923e-01 0.0580076970
## [133,] 7.627794e-01 0.2372205881
## [134,] 9.716059e-01 0.0283940621
## [135,] 9.857297e-01 0.0142702671
## [136,] 6.263129e-01 0.3736871310
## [137,] 1.025523e-04 0.9998974477
## [138,] 3.379132e-08 0.9999999662
## [139,] 1.313754e-06 0.9999986862
## [140,] 3.905897e-05 0.9999609410
## [141,] 7.453696e-05 0.9999254630
## [142,] 2.178816e-07 0.9999997821
## [143,] 3.577086e-04 0.9996422914
## [144,] 1.111444e-01 0.8888555843
## [145,] 9.977284e-01 0.0022715584
## [146,] 9.994734e-01 0.0005265749
## [147,] 9.998856e-01 0.0001143637
## [148,] 9.996477e-01 0.0003523199
## [149,] 9.977284e-01 0.0022715584
## [150,] 9.857297e-01 0.0142702671
## [151,] 8.304658e-01 0.1695341651
## [152,] 9.945593e-01 0.0054407162
## [153,] 9.595136e-01 0.0404864062
## [154,] 9.716059e-01 0.0283940621
## [155,] 8.575863e-01 0.1424136553
## [156,] 8.304658e-01 0.1695341651
## [157,] 9.959755e-01 0.0040244821
## [158,] 9.986627e-01 0.0013372679
## [159,] 7.218141e-01 0.2781858687
## [160,] 1.452097e-05 0.9999854790
## [161,] 1.508924e-07 0.9999998491
## [162,] 9.221150e-07 0.9999990779
## [163,] 1.866715e-06 0.9999981333
## [164,] 6.454926e-07 0.9999993545
## [165,] 1.508924e-07 0.9999998491
## [166,] 1.313754e-06 0.9999986862
## [167,] 1.520794e-02 0.9847920649
## [168,] 9.761633e-01 0.0238367343
## [169,] 9.990758e-01 0.0009241555
## [170,] 9.997736e-01 0.0002264399
## [171,] 9.989575e-01 0.0010425088
## [172,] 9.992679e-01 0.0007320671
## [173,] 9.992679e-01 0.0007320671
## [174,] 9.831037e-01 0.0168963173
## [175,] 9.595136e-01 0.0404864062
## [176,] 9.167246e-01 0.0832754082
## [177,] 7.989583e-01 0.2010416899
## [178,] 9.661198e-01 0.0338802240
## [179,] 8.575863e-01 0.1424136553
## [180,] 9.973895e-01 0.0026104569
## [181,] 9.993458e-01 0.0006541739
## [182,] 9.857297e-01 0.0142702671
## [183,] 6.572906e-04 0.9993427094
## [184,] 6.572906e-04 0.9993427094
## [185,] 5.269627e-06 0.9999947304
## [186,] 7.407705e-06 0.9999925923
## [187,] 5.269627e-06 0.9999947304
## [188,] 5.402936e-05 0.9999459706
## [189,] 1.925677e-04 0.9998074323
## [190,] 2.501669e-01 0.7498331443
## [191,] 9.990758e-01 0.0009241555
## [192,] 9.997071e-01 0.0002928552
## [193,] 9.993458e-01 0.0006541739
## [194,] 9.897516e-01 0.0102484466
## [195,] 9.989575e-01 0.0010425088
## [196,] 9.879207e-01 0.0120793257
## [197,] 2.501669e-01 0.7498331443
## [198,] 9.897516e-01 0.0102484466
## [199,] 9.167246e-01 0.0832754082
## [200,] 9.936498e-01 0.0063502097
## [201,] 9.799516e-01 0.0200484448
## [202,] 9.980181e-01 0.0019818679
## [203,] 9.973895e-01 0.0026104569
## [204,] 9.994734e-01 0.0005265749
## [205,] 9.799516e-01 0.0200484448
## [206,] 2.866203e-03 0.9971337971
## [207,] 2.578993e-02 0.9742100693
## [208,] 8.833666e-03 0.9911663343
## [209,] 3.815057e-03 0.9961849434
## [210,] 7.453696e-05 0.9999254630
## [211,] 8.857535e-02 0.9114246485
## [212,] 9.982663e-01 0.0017336932
## [213,] 9.989575e-01 0.0010425088
## [214,] 9.984794e-01 0.0015206154
## [215,] 9.997910e-01 0.0002089524
## [216,] 9.997540e-01 0.0002460495
## [217,] 9.993458e-01 0.0006541739
## [218,] 9.973895e-01 0.0026104569
## [219,] 9.897516e-01 0.0102484466
## [220,] 9.167246e-01 0.0832754082
## [221,] 8.575863e-01 0.1424136553
## [222,] 7.005216e-02 0.9299478421
## [223,] 7.627794e-01 0.2372205881
## [224,] 9.304989e-01 0.0695010753
## [225,] 9.984794e-01 0.0015206154
## [226,] 9.965253e-01 0.0034746810
## [227,] 9.994734e-01 0.0005265749
## [228,] 9.989575e-01 0.0010425088
## [229,] 9.002717e-01 0.0997283356
## [230,] 5.502849e-02 0.9449715104
## [231,] 1.603787e-03 0.9983962127
## [232,] 5.062899e-03 0.9949371006
## [233,] 3.815057e-03 0.9961849434
## [234,] 1.703641e-01 0.8296359114
## [235,] 8.304658e-01 0.1695341651
## [236,] 9.831037e-01 0.0168963173
## [237,] 9.912842e-01 0.0087157776
## [238,] 9.989575e-01 0.0010425088
## [239,] 9.997910e-01 0.0002089524
## [240,] 9.990758e-01 0.0009241555
## [241,] 9.925696e-01 0.0074303606
## [242,] 4.602700e-01 0.5397300341
## [243,] 1.984445e-02 0.9801555498
## [244,] 5.062899e-03 0.9949371006
## [245,] 2.578993e-02 0.9742100693
## [246,] 1.111444e-01 0.8888555843
## [247,] 2.975310e-01 0.7024689524
## [248,] 9.761633e-01 0.0238367343
## [249,] 9.980181e-01 0.0019818679
## [250,] 9.996477e-01 0.0003523199
## [251,] 9.994139e-01 0.0005861329
## [252,] 8.575863e-01 0.1424136553
## [253,] 5.502849e-02 0.9449715104
## [254,] 1.520794e-02 0.9847920649
## [255,] 1.603787e-03 0.9983962127
## [256,] 3.336928e-02 0.9666307236
## [257,] 6.761853e-01 0.3238146899
## [258,] 7.627794e-01 0.2372205881
## [259,] 7.218141e-01 0.2781858687
## [260,] 9.897516e-01 0.0102484466
## [261,] 9.984794e-01 0.0015206154
## [262,] 9.959755e-01 0.0040244821
## [263,] 9.167246e-01 0.0832754082
## [264,] 2.578993e-02 0.9742100693
## [265,] 2.628114e-04 0.9997371886
## [266,] 2.866203e-03 0.9971337971
## [267,] 1.984445e-02 0.9801555498
## [268,] 8.857535e-02 0.9114246485
## [269,] 8.833666e-03 0.9911663343
## [270,] 8.857535e-02 0.9114246485
## [271,] 9.925696e-01 0.0074303606
## [272,] 9.977284e-01 0.0022715584
## [273,] 9.996477e-01 0.0003523199
## [274,] 9.993458e-01 0.0006541739
## [275,] 9.167246e-01 0.0832754082
## [276,] 4.602700e-01 0.5397300341
## [277,] 3.490711e-01 0.6509289127
## [278,] 2.975310e-01 0.7024689524
## [279,] 8.807086e-01 0.1192914131
## [280,] 4.037536e-01 0.5962464130
## [281,] 6.761853e-01 0.3238146899
## [282,] 9.959755e-01 0.0040244821
## [283,] 9.969922e-01 0.0030077968
## [284,] 9.997319e-01 0.0002680747
## [285,] 9.953267e-01 0.0046733314
## [286,] 9.936498e-01 0.0063502097
## [287,] 9.936498e-01 0.0063502097
## [288,] 1.520794e-02 0.9847920649
## [289,] 1.520794e-02 0.9847920649
## [290,] 7.407705e-06 0.9999925923
## [291,] 1.025523e-04 0.9998974477
## [292,] 6.698270e-03 0.9933017297
## [293,] 7.218141e-01 0.2781858687
## [294,] 9.965253e-01 0.0034746810
## [295,] 9.977284e-01 0.0022715584
## [296,] 9.994734e-01 0.0005265749
## [297,] 9.969922e-01 0.0030077968
## [298,] 9.799516e-01 0.0200484448
## [299,] 9.515602e-01 0.0484397660
## [300,] 8.575863e-01 0.1424136553
## [301,] 9.419923e-01 0.0580076970
## [302,] 9.761633e-01 0.0238367343
## [303,] 9.595136e-01 0.0404864062
## [304,] 9.936498e-01 0.0063502097
## [305,] 9.982663e-01 0.0017336932
## [306,] 9.925696e-01 0.0074303606
## [307,] 9.998444e-01 0.0001556203
## [308,] 9.997319e-01 0.0002680747
## [309,] 9.879207e-01 0.0120793257
## [310,] 6.572906e-04 0.9993427094
## [311,] 4.506430e-07 0.9999995494
## [312,] 3.738616e-06 0.9999962614
## [313,] 4.931943e-08 0.9999999507
## [314,] 9.221150e-07 0.9999990779
## [315,] 1.925677e-04 0.9998074323
## [316,] 1.984445e-02 0.9801555498
## [317,] 9.982663e-01 0.0017336932
## [318,] 9.996792e-01 0.0003207845
## [319,] 9.994734e-01 0.0005265749
## [320,] 9.925696e-01 0.0074303606
## [321,] 8.807086e-01 0.1192914131
## [322,] 9.912842e-01 0.0087157776
## [323,] 9.980181e-01 0.0019818679
## [324,] 9.831037e-01 0.0168963173
## [325,] 9.167246e-01 0.0832754082
## [326,] 8.304658e-01 0.1695341651
## [327,] 9.002717e-01 0.0997283356
## [328,] 9.986627e-01 0.0013372679
## [329,] 9.993458e-01 0.0006541739
## [330,] 9.953267e-01 0.0046733314
## [331,] 9.912842e-01 0.0087157776
## [332,] 5.502849e-02 0.9449715104
## [333,] 1.925677e-04 0.9998074323
## [334,] 1.042195e-07 0.9999998958
## [335,] 1.042195e-07 0.9999998958
## [336,] 2.645312e-06 0.9999973547
## [337,] 2.816080e-05 0.9999718392
## [338,] 3.905897e-05 0.9999609410
## [339,] 5.171571e-01 0.4828429088
## [340,] 9.973895e-01 0.0026104569
## [341,] 9.992679e-01 0.0007320671
## [342,] 9.996477e-01 0.0003523199
## [343,] 9.993458e-01 0.0006541739
## [344,] 9.973895e-01 0.0026104569
## [345,] 9.419923e-01 0.0580076970
## [346,] 9.304989e-01 0.0695010753
## [347,] 9.945593e-01 0.0054407162
## [348,] 9.831037e-01 0.0168963173
## [349,] 9.799516e-01 0.0200484448
## [350,] 9.965253e-01 0.0034746810
## [351,] 9.953267e-01 0.0046733314
## [352,] 9.993458e-01 0.0006541739
## [353,] 9.997319e-01 0.0002680747
## [354,] 9.980181e-01 0.0019818679
## [355,] 2.501669e-01 0.7498331443
## [356,] 2.866203e-03 0.9971337971
## [357,] 9.221150e-07 0.9999990779
## [358,] 3.379132e-08 0.9999999662
## [359,] 1.573566e-08 0.9999999843
## [360,] 1.025523e-04 0.9998974477
## [361,] 1.025523e-04 0.9998974477
## [362,] 1.161102e-02 0.9883889796
## [363,] 9.857297e-01 0.0142702671
## [364,] 9.995257e-01 0.0004743358
## [365,] 9.991786e-01 0.0008214260
## [366,] 9.988208e-01 0.0011791561
## [367,] 9.986627e-01 0.0013372679
## [368,] 9.879207e-01 0.0120793257
## [369,] 8.575863e-01 0.1424136553
## [370,] 9.953267e-01 0.0046733314
## [371,] 9.989575e-01 0.0010425088
## [372,] 9.984794e-01 0.0015206154
## [373,] 9.992679e-01 0.0007320671
## [374,] 9.959755e-01 0.0040244821
## [375,] 9.831037e-01 0.0168963173
## [376,] 9.997540e-01 0.0002460495
## [377,] 9.959755e-01 0.0040244821
## [378,] 1.925677e-04 0.9998074323
## [379,] 6.572906e-04 0.9993427094
## [380,] 3.379132e-08 0.9999999662
## [381,] 4.506430e-07 0.9999995494
## [382,] 5.269627e-06 0.9999947304
## [383,] 7.249456e-09 0.9999999928
## [384,] 2.816080e-05 0.9999718392
## [385,] 3.336928e-02 0.9666307236
## [386,] 9.897516e-01 0.0102484466
## [387,] 9.996792e-01 0.0003207845
## [388,] 9.991786e-01 0.0008214260
## [389,] 9.991786e-01 0.0008214260
## [390,] 9.925696e-01 0.0074303606
## [391,] 4.602700e-01 0.5397300341
## [392,] 9.925696e-01 0.0074303606
## [393,] 9.965253e-01 0.0034746810
## [394,] 9.980181e-01 0.0019818679
## [395,] 9.989575e-01 0.0010425088
## [396,] 9.977284e-01 0.0022715584
## [397,] 9.953267e-01 0.0046733314
## [398,] 9.995257e-01 0.0004743358
## [399,] 9.998332e-01 0.0001668458
## [400,] 9.995716e-01 0.0004284240
## [401,] 9.595136e-01 0.0404864062
## [402,] 1.038538e-05 0.9999896146
## [403,] 9.221150e-07 0.9999990779
## [404,] 1.042195e-07 0.9999998958
## [405,] 2.221772e-09 0.9999999978
## [406,] 4.421641e-10 0.9999999996
## [407,] 3.622128e-11 1.0000000000
## [408,] 7.407705e-06 0.9999925923
## [409,] 7.627794e-01 0.2372205881
## [410,] 9.998332e-01 0.0001668458
## [411,] 9.997910e-01 0.0002089524
## [412,] 9.996120e-01 0.0003879932
## [413,] 9.982663e-01 0.0017336932
## [414,] 9.002717e-01 0.0997283356
## [415,] 9.912842e-01 0.0087157776
## [416,] 9.973895e-01 0.0026104569
## [417,] 9.988208e-01 0.0011791561
## [418,] 9.982663e-01 0.0017336932
## [419,] 9.982663e-01 0.0017336932
## [420,] 9.989575e-01 0.0010425088
## [421,] 9.984794e-01 0.0015206154
## [422,] 9.996477e-01 0.0003523199
## [423,] 9.998332e-01 0.0001668458
## [424,] 9.936498e-01 0.0063502097
## [425,] 1.194600e-03 0.9988053997
## [426,] 6.646757e-10 0.9999999993
## [427,] 1.573566e-08 0.9999999843
## [428,] 4.900815e-09 0.9999999951
## [429,] 1.941048e-10 0.9999999998
## [430,] 1.042195e-07 0.9999998958
## [431,] 2.866203e-03 0.9971337971
## [432,] 9.989575e-01 0.0010425088
## [433,] 9.997319e-01 0.0002680747
## [434,] 9.945593e-01 0.0054407162
## [435,] 9.984794e-01 0.0015206154
## [436,] 9.995257e-01 0.0004743358
## [437,] 9.989575e-01 0.0010425088
## [438,] 9.990758e-01 0.0009241555
## [439,] 9.982663e-01 0.0017336932
## [440,] 9.925696e-01 0.0074303606
## [441,] 9.716059e-01 0.0283940621
## [442,] 9.977284e-01 0.0022715584
## [443,] 9.991786e-01 0.0008214260
## [444,] 9.984794e-01 0.0015206154
## [445,] 9.959755e-01 0.0040244821
## [446,] 8.807086e-01 0.1192914131
## [447,] 8.873383e-04 0.9991126617
## [448,] 3.379132e-08 0.9999999662
## [449,] 4.421641e-10 0.9999999996
## [450,] 2.933542e-10 0.9999999997
## [451,] 4.900815e-09 0.9999999951
## [452,] 2.309019e-08 0.9999999769
## [453,] 4.506430e-07 0.9999995494
## [454,] 1.984445e-02 0.9801555498
## [455,] 9.959755e-01 0.0040244821
## [456,] 9.997736e-01 0.0002264399
## [457,] 9.996477e-01 0.0003523199
## [458,] 9.991786e-01 0.0008214260
## [459,] 9.995716e-01 0.0004284240
## [460,] 9.989575e-01 0.0010425088
## [461,] 9.973895e-01 0.0026104569
## [462,] 9.990758e-01 0.0009241555
## [463,] 9.992679e-01 0.0007320671
## [464,] 9.993458e-01 0.0006541739
## [465,] 9.993458e-01 0.0006541739
## [466,] 9.995716e-01 0.0004284240
## [467,] 9.993458e-01 0.0006541739
## [468,] 9.990758e-01 0.0009241555
## [469,] 9.988208e-01 0.0011791561
## [470,] 9.002717e-01 0.0997283356
## [471,] 5.402936e-05 0.9999459706
## [472,] 6.646757e-10 0.9999999993
## [473,] 7.249456e-09 0.9999999928
## [474,] 2.933542e-10 0.9999999997
## [475,] 1.573566e-08 0.9999999843
## [476,] 2.816080e-05 0.9999718392
## [477,] 3.490711e-01 0.6509289127
## [478,] 9.953267e-01 0.0046733314
## [479,] 9.977284e-01 0.0022715584
## [480,] 9.984794e-01 0.0015206154
## [481,] 9.996792e-01 0.0003207845
## [482,] 9.997736e-01 0.0002264399
## [483,] 9.993458e-01 0.0006541739
## [484,] 9.936498e-01 0.0063502097
## [485,] 9.996477e-01 0.0003523199
## [486,] 9.986627e-01 0.0013372679
## [487,] 9.973895e-01 0.0026104569
## [488,] 9.992679e-01 0.0007320671
## [489,] 9.991786e-01 0.0008214260
## [490,] 9.982663e-01 0.0017336932
## [491,] 9.986627e-01 0.0013372679
## [492,] 9.992679e-01 0.0007320671
## [493,] 9.959755e-01 0.0040244821
## [494,] 1.603787e-03 0.9983962127
## [495,] 1.280901e-10 0.9999999999
## [496,] 2.221772e-09 0.9999999978
## [497,] 2.309019e-08 0.9999999769
## [498,] 3.379132e-08 0.9999999662
## [499,] 7.179033e-08 0.9999999282
## [500,] 7.218141e-01 0.2781858687
## [501,] 9.991786e-01 0.0008214260
## [502,] 9.997071e-01 0.0002928552
## [503,] 9.990758e-01 0.0009241555
## [504,] 9.991786e-01 0.0008214260
## [505,] 9.997910e-01 0.0002089524
## [506,] 9.997736e-01 0.0002264399
## [507,] 9.936498e-01 0.0063502097
## [508,] 9.959755e-01 0.0040244821
## [509,] 9.969922e-01 0.0030077968
## [510,] 9.992679e-01 0.0007320671
## [511,] 9.990758e-01 0.0009241555
## [512,] 9.993458e-01 0.0006541739
##
## $all.loglik
## [1] 33.62315 267.27800 267.27803 267.27805 267.27807 267.27810 267.27813
## [8] 267.27820 267.27834 267.27876 267.28060 267.28892 267.32825 267.54822
## [15] 268.88436 275.84313 292.18879 305.77991 313.86924 320.87115 328.68313
## [22] 337.37322 345.90358 353.16521 359.20683 364.62688 369.63596 373.96498
## [29] 377.23954 379.39556 380.69192 381.44775 381.89186 382.15885 382.32352
## [36] 382.42748 382.49444 382.53831 382.56745 382.58703 382.60031 382.60939
## [43] 382.61563 382.61996 382.62296 382.62506 382.62652 382.62755 382.62827
## [50] 382.62878 382.62914 382.62939 382.62957 382.62970 382.62979 382.62985
## [57] 382.62990 382.62993 382.62995 382.62997 382.62998 382.62999 382.63000
## [64] 382.63000 382.63000 382.63001 382.63001 382.63001 382.63001 382.63001
## [71] 382.63001 382.63001 382.63001 382.63001 382.63001 382.63001 382.63001
## [78] 382.63001 382.63001 382.63001 382.63001 382.63001
##
## $restarts
## [1] 0
##
## $ft
## [1] "normalmixEM"
##
## attr(,"class")
## [1] "mixEM"
# Extract mean and variance for each mode
mean_mode1 <- fit_result$mu[1]
print(mean_mode1)
## [1] 0.433396
variance_mode1 <- fit_result$sigma[1]^2
mean_mode2 <- fit_result$mu[2]
print(mean_mode2)
## [1] 0.6993034
variance_mode2 <- fit_result$sigma[2]^2
# Outlier detection
# Calculate lower and upper bounds for 0.001 probability limits
lower_limit_c <- qnorm(0.001, mean_mode1, sqrt(variance_mode1))
print(lower_limit_c)
## [1] 0.2580815
upper_limit_c <- qnorm(0.999, mean_mode2, sqrt(variance_mode2))
print(upper_limit_c)
## [1] 0.9640026
for(j in 1:512){
for(i in 1:length(img[,j])){
# Paint black outliers
if(column_img[i,j] > upper_limit_c | column_img[i,j] < lower_limit_c){
column_img[i,j] = 0
}
}
}
par(mfrow = c(1,2))
# Plotting Images
plot(NA,xlim=c(0,nrow(img)),ylim=c(0,ncol(img)),xlab="Horizontal",ylab="Vertical")
rasterImage(img,0,0,nrow(img),ncol(img))
plot(NA,xlim=c(0,nrow(column_img)),ylim=c(0,ncol(column_img)),xlab="Horizontal",ylab="Vertical")
rasterImage(column_img,0,0,nrow(column_img),ncol(column_img))
Although some of the linen errors are detected, the total accuracy is far beyond from sufficient. Therefore this model does not hold for this case as well.
The spatial data control procedure is designed to address the inherent 2D nature of image data, acknowledging that neighboring pixel values in an image may exhibit spatial relationships. This novel approach utilizes a statistic to identify regions of the image that may indicate irregularities or defects. When we work on an image which has a texture, the pixel values are related to the surrounding pixels in its neighborhood region. Hence detecting patches that center pixel is not significantly related to its neighborhood pixels in a standard regression function is a valid method to identify the regions of the image that might be problematic.
Procedure:
Feature Extraction:
The proposed method starts by extracting features from 3x3 blocks within the image, excluding the center pixel. This process is designed to capture the local context around each pixel.
Model Training:
A linear regression model is trained using the extracted features to understand the relationships between the center pixel and its surrounding context.
| x1 | x2 | x3 |
| x4 | y | x5 |
| x6 | x7 | x8 |
y is the center of the 3x3 patch and it is the response variable in the regression model. xi s are the predictor variables.
Residual Analysis:
Residuals are calculated to identify deviations between the predicted and actual center pixel values.
Control Limits:
Control limits are established based on the distribution of residuals.
upper_limit <- mean_residuals + 3sd_residuals lower_limit <- mean_residuals - 3sd_residuals
Patches with residuals beyond these limits are flagged as potentially defective.
Defect Identification:
Patches with residuals outside the control limits are identified and subsequently marked for further processing.
Image Modification:
The identified patches with potential defects are deleted from the original image and modified image is displayed.
library(jpeg)
library(MASS)
library(mixtools)
library(magick)
## Linking to ImageMagick 6.9.12.93
## Enabled features: cairo, fontconfig, freetype, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fftw, ghostscript, x11
# Read the image
input_image_path <- "~/Desktop/Dersler/IE423/rawimage/0115.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/0115.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
img<- readJPEG("~/Desktop/Dersler/IE423/outputimage.jpg")
# Our Proposal
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(img) - 2, by = 3), function(i) {
lapply(seq(1, ncol(img) - 2, by = 3), function(j) {
extract_features(img[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_img <- img
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(img)/3) * 3 + 1
j <- (index - 1) %% (ncol(img)/3) * 3 + 1
filtered_img[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(img, 0, 0, 512, 512)
# Add titles to the plots
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_img, 0, 0, 512, 512)
title(main="Filtered Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
5 images are randomly selected to evaluate “our proposal” on alternative images.
# First sample
# Read the image
input_image_path <-"~/Desktop/Dersler/IE423/rawimage/0075.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/new0075.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
image_path1<- readJPEG("~/Desktop/Dersler/IE423/new0075.jpg")
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(image_path1) - 2, by = 3), function(i) {
lapply(seq(1, ncol(image_path1) - 2, by = 3), function(j) {
extract_features(image_path1[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_image1 <- image_path1
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(image_path1)/3) * 3 + 1
j <- (index - 1) %% (ncol(image_path1)/3) * 3 + 1
filtered_image1[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(image_path1, 0, 0, 512, 512)
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_image1, 0, 0, 512, 512)
title(main="Filtered Image_Path1", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Second Sample
# Read the image
input_image_path <-"~/Desktop/Dersler/IE423/rawimage/0054.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/new0054.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
image_path2<- readJPEG("~/Desktop/Dersler/IE423/new0054.jpg")
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(image_path2) - 2, by = 3), function(i) {
lapply(seq(1, ncol(image_path2) - 2, by = 3), function(j) {
extract_features(image_path2[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_image2 <- image_path2
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(image_path2)/3) * 3 + 1
j <- (index - 1) %% (ncol(image_path2)/3) * 3 + 1
filtered_image2[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(image_path2, 0, 0, 512, 512)
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_image2, 0, 0, 512, 512)
title(main="Filtered Image_Path2", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Third Sample
# Read the image
input_image_path <-"~/Desktop/Dersler/IE423/rawimage/0163.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/new0163.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
image_path3<- readJPEG("~/Desktop/Dersler/IE423/new0163.jpg")
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(image_path3) - 2, by = 3), function(i) {
lapply(seq(1, ncol(image_path3) - 2, by = 3), function(j) {
extract_features(image_path3[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_image3 <- image_path3
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(image_path3)/3) * 3 + 1
j <- (index - 1) %% (ncol(image_path3)/3) * 3 + 1
filtered_image3[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(image_path3, 0, 0, 512, 512)
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_image3, 0, 0, 512, 512)
title(main="Filtered Image_Path3", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Forth Sample
# Read the image
input_image_path <-"~/Desktop/Dersler/IE423/rawimage/0073.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/new0073.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
image_path4<- readJPEG("~/Desktop/Dersler/IE423/new0073.jpg")
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(image_path4) - 2, by = 3), function(i) {
lapply(seq(1, ncol(image_path4) - 2, by = 3), function(j) {
extract_features(image_path4[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_image4 <- image_path4
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(image_path4)/3) * 3 + 1
j <- (index - 1) %% (ncol(image_path4)/3) * 3 + 1
filtered_image4[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(image_path4, 0, 0, 512, 512)
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_image4, 0, 0, 512, 512)
title(main="Filtered Image_Path4", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Fifth Sample
# Read the image
input_image_path <-"~/Desktop/Dersler/IE423/rawimage/0118.jpg" # Replace with your image file path
output_image_path <- "~/Desktop/Dersler/IE423/new0118.jpg" # Replace with the desired output file path
# Read the input image
input_image <- image_read(input_image_path)
# Convert the image to grayscale
grayscale_image <- image_convert(input_image, colorspace = "gray")
# Write the grayscale image to the output path
image_write(grayscale_image, path = output_image_path)
image_path5<- readJPEG("~/Desktop/Dersler/IE423/new0118.jpg")
# Function to extract features from a 3x3 block (excluding center pixel)
extract_features <- function(block) {
center_pixel <- block[2, 2]
predictor_variables <- as.vector(block) # Flatten the block into a vector
predictor_variables <- predictor_variables[predictor_variables != center_pixel] # Exclude the center pixel
return(data.frame(center_pixel = center_pixel, predictor1 = predictor_variables[1], predictor2 =predictor_variables[2],
predictor3 = predictor_variables[3], predictor4 =predictor_variables[4],
predictor5 = predictor_variables[5], predictor6 =predictor_variables[6],
predictor7 = predictor_variables[7], predictor8 =predictor_variables[8]))
}
# Function to calculate residuals and append to the list
check_residuals <- function(model, data) {
y <- data$center_pixel
X <- data[-1] # Exclude the response variable
residuals <- y - predict(model, newdata = X)
return(residuals)
}
# You can set your own control limits based on your criteria
# Extract non-overlapping 3x3 blocks and extract features
blocks <- lapply(seq(1, nrow(image_path5) - 2, by = 3), function(i) {
lapply(seq(1, ncol(image_path5) - 2, by = 3), function(j) {
extract_features(image_path5[i:(i+2), j:(j+2)])
})
})
# Flatten the list structure
flat_blocks <- unlist(blocks, recursive = FALSE)
# Create a data frame for training the model
train_data <- do.call(rbind, flat_blocks)
# Train a linear regression model
model <- lm(center_pixel ~ predictor1 + predictor2 + predictor3 + predictor4 +
predictor5 + predictor6 + predictor7 + predictor8, data = train_data)
# Check residuals and control limits for each block
residuals_list <- lapply(flat_blocks, function(block) {
check_residuals(model, block)
})
# Extract numeric values from the residuals_list
numeric_residuals <- sapply(residuals_list, function(residual) {
as.numeric(residual)
})
# Calculate the mean of the residuals
mean_residuals <- mean(numeric_residuals, na.rm = TRUE)
sd_residuals <-sd(numeric_residuals, na.rm = TRUE)
upper_limit <- mean_residuals + 3*sd_residuals
lower_limit <- mean_residuals - 3*sd_residuals
# Identify and remove patches with residuals outside control limits
out_of_limits_indices <- which(sapply(residuals_list, function(residuals) {
any(residuals > upper_limit | residuals < lower_limit)
}))
filtered_image5 <- image_path5
for (index in out_of_limits_indices) {
i <- (index - 1) %/% (nrow(image_path5)/3) * 3 + 1
j <- (index - 1) %% (ncol(image_path5)/3) * 3 + 1
filtered_image5[i:(i+2), j:(j+2)] <- 0
}
# Display the original and new images in a plot
par(mfrow=c(1,2))
# Original Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(image_path5, 0, 0, 512, 512)
title(main="Original Image", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
# Filtered Image
plot(1, type='n', xlab='', ylab='', xlim=c(0, 512), ylim=c(0, 512))
rasterImage(filtered_image5, 0, 0, 512, 512)
title(main="Filtered Image_Path5", xlab = "Pixel Value", ylab = "Frequency", line = 0.2)
1. A Baseline Defect Detection Approach from a Statistical Data Analysis Perspective:
Purpose: -Identify the underlying bimodal distribution in the pixel values of the entire image. -Understand the statistical characteristics of the image data.
Implications: -Provides a global perspective on the distribution of pixel values. -Assumes that the entire image can be accurately represented by a bimodal distribution.
2. A Baseline Defect Detection Approach from a Statistical Data Analysis Perspective in 51x51 Patches:
Purpose: -Analyze local variations in pixel values within smaller patches (51x51). -Apply bimodal distribution fitting to each patch independently.
Implications: -Captures local characteristics and variations within the image. -Allows for more nuanced analysis compared to a global approach. -Assumes that local regions may exhibit different statistical properties.
3. Simple Defect Detection Approach from a Control Chart Perspective
Purpose: -Detect outliers along rows and columns in the image. -Apply statistical process control principles to identify abnormal patterns.
Implications: -Focuses on identifying outliers and patterns that may not be captured by a global or local distribution fitting approach. -Can reveal systematic anomalies or artifacts that occur along rows or columns.
4. Our Approach
Purpose: The purpose of the proposed spatial data control procedure is to develop a robust method for defect identification in images, particularly addressing the inherent 2D nature of image data. By acknowledging the spatial relationships among neighboring pixels, the procedure aims to detect irregularities or defects in image regions where pixel values exhibit significant deviations from their surrounding context. This approach utilizes statistical methods, specifically linear regression modeling, to understand and quantify the relationships between the center pixel and its neighboring pixels in local patches. The overarching goal is to provide a systematic and efficient way to identify and potentially rectify defective regions within an image.
Implications: -Improved Defect Detection: The proposed procedure leverages spatial information to enhance defect detection. This could lead to improved accuracy in identifying problematic regions within an image compared to traditional methods that may not consider local relationships. -Adaptability to Various Textures: As the method focuses on local context and does not rely on pre-defined defect patterns, it may be adaptable to various textures and types of images. This flexibility makes it potentially applicable to a wide range of industries and domains. -Quantitative Assessment of Defects: The use of linear regression allows for a quantitative assessment of the relationships between pixels. This not only aids in identifying defects but also provides a measure of how much the center pixel deviates from what is expected based on its local context.